public function testWasSyncedAtLeastOnce() { $channel = new Channel(); $status = new Status(); $status->setChannel($channel)->setCode(Status::STATUS_COMPLETED); $this->assertFalse(FormUtils::wasSyncedAtLeastOnce($channel)); $channel->addStatus($status); $this->assertTrue(FormUtils::wasSyncedAtLeastOnce($channel)); }
/** * Disable fields that are not allowed to be modified since channel has at least one sync completed * * @param FormInterface $form */ protected function muteFields(FormInterface $form) { if (!$form->getParent()) { return; } /** @var Channel $channel */ $channel = $form->getParent()->getData(); // if channel is new if (!$channel || !$channel->getId()) { return; } if (IntegrationFormUtils::wasSyncedAtLeastOnce($channel)) { // disable start sync date FormUtils::replaceField($form, 'syncStartDate', ['disabled' => true]); // disable websites selector FormUtils::replaceField($form, 'websiteId', ['disabled' => true]); } }