Skip to content

Commit

Permalink
Europa
Browse files Browse the repository at this point in the history
  • Loading branch information
timkelty committed Mar 18, 2024
1 parent a070e92 commit 2a5e3ec
Show file tree
Hide file tree
Showing 4 changed files with 841 additions and 2,239 deletions.
59 changes: 29 additions & 30 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions config/project/project.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dateModified: 1707334272
dateModified: 1710778883
elementSources:
craft\elements\Asset:
-
Expand Down Expand Up @@ -401,5 +401,5 @@ system:
live: true
name: 'Europa Museum'
retryDuration: null
schemaVersion: 5.0.0.19
schemaVersion: 5.0.0.20
timeZone: America/Los_Angeles
14 changes: 7 additions & 7 deletions modules/demos/src/console/controllers/SeedController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
use craft\helpers\FileHelper;
use Faker\Generator as FakerGenerator;
use Solspace\Freeform\Elements\Submission;
use Solspace\Freeform\Form\Form;
use Solspace\Freeform\Freeform;
use Solspace\Freeform\Library\Composer\Components\Form;
use yii\console\ExitCode;

class SeedController extends Controller
Expand Down Expand Up @@ -44,7 +44,8 @@ public function init(): void
public function actionIndex(): int
{
$this->stdout('Beginning seed ... ' . PHP_EOL . PHP_EOL);
$this->runAction('freeform-data', ['contact']);
// TODO: get this to work with v5
// $this->runAction('freeform-data', ['contact']);
$this->runAction('refresh-news');
$this->_cleanup();
$this->stdout('Seed complete.' . PHP_EOL . PHP_EOL, Console::FG_GREEN);
Expand Down Expand Up @@ -114,7 +115,7 @@ public function actionFreeformData(string $formHandle): int
$this->stdout("Seeding Freeform data ..." . PHP_EOL);

$freeform = Freeform::getInstance();
$form = $freeform->forms->getFormByHandle($formHandle)->getForm();
$form = $freeform->forms->getFormByHandle($formHandle);
$submissionCount = $this->_faker->numberBetween(self::FREEFORM_SUBMISSION_MIN, self::FREEFORM_SUBMISSION_MAX);
$errorCount = 0;

Expand Down Expand Up @@ -156,14 +157,13 @@ public function actionRefreshNews(): int

private function _createFormSubmission(Form $form): Submission
{
/** @var Submission $submission */
$submission = Freeform::getInstance()->submissions->createSubmissionFromForm($form);
$submission = Submission::create($form);
$submission->dateCreated = $submission->dateUpdated = $this->_faker->dateTimeThisMonth();

// Reparse the title with the fake date
$submission->title = Craft::$app->view->renderString(
$form->getSubmissionTitleFormat(),
$form->getLayout()->getFieldsByHandle() + [
$form->getSubmission()->title,
$form->getLayout()->getFields()->getListByHandle() + [
'dateCreated' => $submission->dateCreated,
'form' => $form,
]
Expand Down
Loading

0 comments on commit 2a5e3ec

Please sign in to comment.