Initialize blames limit.
@param ModelEvent $event
485430
public function onInitBlamesLimit($event)
    {
        $sender = $event->sender;
        if (!is_int($sender->blamesLimit) || $sender->blamesLimit < 1 || $sender->blamesLimit > 64) {
            $sender->blamesLimit = 10;
        }
    }
393305
public function initialize($eventName)
    {
        $this->assertNotEmpty();

        $step = $this->getStepForEvent($eventName);

        $this->currentStep = $step->getName();

        $this->initialized = true;
    }
698904
final protected function apply(DomainEvent $event) : void
    {
        $this->handleEventInAggregate($event);
        parent::raise($event);
    }
946792
protected function initializeEvents($eventsDefinition)
    {
        foreach ($eventsDefinition as $variableName => $eventValue) {
            $value = array();

            if (!empty($eventValue) && !\is_array($eventValue)) {
                $value = [$eventValue];
            } elseif (\is_array($eventValue)) {
                $value = $eventValue;
            }

            $this->$variableName = $value;
        }
    }
854908
public function beforeFilter(\Cake\Event\Event $event)
    {
        parent::beforeFilter($event);

        // get the type-string
        $type = $this->PostTypes->postTypeFinder($this->request);
        $this->_type = $type;

        // check if the string exists. Will throw an exception
        $this->PostTypes->check($type, ['exception' => true]);

        // intialize the settings
        $this->Settings = $this->PostTypes->get($type);

        // lets initialize the model too
        $this->Model = $this->loadModel($this->Settings['model']);
    }
1289510
public function startFor(Domain\Event $event) : void
    {
        if (true === $this->started()) {
            throw new Exception\SubscriptionAlreadyStarted($this);
        }

        $this->applyEvent(new SubscriptionStarted($event, $this->clock->now()));
    }
289153
private function updateCounter(ModelEvent $event, $action)
    {
        if (!$this->constraint->isVersioningService()) {
            return;
        }

        $qb = $this->documentManager->createQueryBuilder($event->getCollectionClass());
        if ('update' == $action) {
            $qb->findAndUpdate()
                ->field('id')->equals($event->getCollectionId())
                ->field(VersionServiceConstraint::FIELD_NAME)->inc(1)
                ->getQuery()->execute();
        } else {
            $qb->findAndUpdate()
                ->field('id')->equals($event->getCollectionId())
                ->field(VersionServiceConstraint::FIELD_NAME)->set(1)
                ->getQuery()->execute();
        }
    }
892973
public function beforeValidationOnCreate(Event $event, Model $model)
    {
        if($model instanceof ITimestampable) {
            $now = $this->getNow();
            if(!$model->getCreatedAt()) {
                $model->setCreatedAt($now);
            }
            if(!$model->getUpdatedAt()) {
                $model->setUpdatedAt($now);
            }
        }
    }
628337
public function initialize(Event $event) {
		$table = $event->getSubject();
		if (!in_array(get_class($table), $this->config['tableClass'])) {
			return;
		}

		$this->_setValidators($table);
	}
1062047
protected function when(DomainEvent $event)
    {
        $method = 'when' . ClassToString::short($event);
        if (is_callable([$this, $method])) {
            $this->{$method}($event);
        }
    }
288990
private function handleFallback(AbstractModelAwareEvent $event)
    {
        $model        = $event->getModel();
        $dataProvider = $event->getEnvironment()->getDataProvider($model->getProviderName());
        $properties   = $event->getEnvironment()->getDataDefinition()->getPropertiesDefinition();

        foreach (\array_keys($model->getPropertiesAsArray()) as $propertyName) {
            if (!$properties->hasProperty($propertyName)) {
                continue;
            }
            $property = $properties->getProperty($propertyName);
            $extra    = (array) $property->getExtra();
            if (\array_key_exists('fallback', $extra) && (true === $extra['fallback'])) {
                // BC Layer - use old reset fallback methodology until it get's removed.
                if (null === ($config = $this->determineFilterConfig($event))) {
                    // @codingStandardsIgnoreStart
                    @\trigger_error(
                        'DataProviderInterface::resetFallback is deprecated - ' .
                        'Please specify proper parent child relationship',
                        E_USER_DEPRECATED
                    );
                    // @codingStandardsIgnoreEnd

                    $dataProvider->resetFallback($propertyName);
                }

                // If value is empty, no need to reset the fallback.
                if (!$model->getProperty($propertyName)) {
                    continue;
                }

                $models = $dataProvider->fetchAll($config);

                foreach ($models as $resetModel) {
                    if ($model->getId() === $resetModel->getId()) {
                        continue;
                    }
                    $resetModel->setProperty($propertyName, ModelManipulator::sanitizeValue($property, null));
                    $dataProvider->save($resetModel);
                }
            }
        }
    }
502759
public function onFind($event)
    {
        if ($this->isAttributeWriteable($event) && $this->onBeforeFind($event)) {
            if ($this->i18n) {
                $event->sender->setAttribute($this->name, $this->i18nDecodedGetActive($this->i18nFieldDecode($event->sender->getAttribute($this->name), $this->i18nEmptyValue)));
            }
            
            $this->onAfterFind($event);
        }
    }
564525
protected function handle(Event $event): void
    {
        $method = 'apply'.ClassName::short($event);

        if (!method_exists($this, $method)) {
            return;
        }

        $this->$method($event);
    }
667180
public function onPostDeserialize(ObjectEvent $event)
    {
        /** @var TargetGroupRuleInterface $targetGroupRule */
        $targetGroupRule = $event->getObject();

        if (!$targetGroupRule instanceof TargetGroupRuleInterface) {
            return;
        }

        if ($targetGroupRule->getConditions()) {
            foreach ($targetGroupRule->getConditions() as $condition) {
                $condition->setRule($targetGroupRule);
            }
        }
    }
440551
@Override
  public void contextInitialized(ServletContextEvent servletContextEvent) {
    otherListeners.addAll(getDefaultOtherListeners());

    contextInitialized(servletContextEvent.getServletContext());

    for(ServletContextListener listener : otherListeners) {
      try {
        listener.contextInitialized(servletContextEvent);
      }
      catch(Exception e){
        classLoaderLeakPreventor.error(e);
      }
    }
  }
394213
public function init(MvcEvent $e)
    {
        $request = $e->getRequest();
        if (!$request instanceof Request) {
            return;
        }

        $sem = $e->getApplication()->getEventManager()->getSharedManager();
        $sem->attach('UploadableManager', 'createFile', [$this, 'onCreateFile']);
    }
641891
public function beforeValidationOnUpdate(Event $event, Model $model)
    {
        if($model instanceof ITimestampable) {
            $now = $this->getNow();
            $model->setUpdatedAt($now);
        }
    }