An article is nothing without its Chapters. Before every fetch
we make sure the chapters are fetched right along, at least in
the CMS.

@param Array $args Event listener parameters
@return Void
490121
public function beforeFetch(&$args) {
        $model = &$args[0];
        $select = &$args[1];

        $isCms = $model->isCmsContext();
        if (!$isCms && !$this->_forceI18nOutput) {
            return;
        }
        $this->_modifySearchQuery($select, $model);
        $this->bindWithI18nModel($model);
    }
627888
public function postLoad(LifecycleEventArgs $args)
    {
        $entity = $args->getEntity();
        $this->translator->translate($entity, $this->localeResolver->getLocale());
    }
851716
protected function setDefaultRoles($args)
    {
        if (!current($this->roles)) {
            $this->roles = $this->toArray($args);
        }
    }
60136
public function prePersist(LifecycleEventArgs $args)
    {
        $object = $args->getObject();
        if ($object instanceof UploadObjectInterface) {
            $this->prepareUploadFileReferences($object);
        }
    }
618944
public function preUpdate(LifecycleEventArgs $args)
    {
        if ($args->getObject() instanceof BlockInterface) {
            $this->getService($args)->preUpdate($args->getObject());
        }
    }
919054
public function beforeInsert(&$args) {
        $model = $args[0];
        $data = &$args[1];
        foreach ($this->_relationConfig as $foreignModel => $modelRelationConfig) {
            $foreignKey = $modelRelationConfig[self::FOREIGN_KEY_COLUMN_KEY];
            // only act if the foreign key column is filled
            if (!empty($data[$foreignKey])) {
                $maxWeight = $this->findHighestWeight($model, $data[$foreignKey], $modelRelationConfig);
                $data[$modelRelationConfig[self::WEIGHT_COLUMN_KEY]] = ($maxWeight+1);
            }
        }
    }
837942
public function run(...$args): void
    {
        $container = $this->getContainer();
        $instance = $container->get($this->classIdentifier);

        $instance->{$this->callbackMethod}(...$args);
    }
374962
public function onFlush($args)
    {
        if (!$this->isDirty) {
            /** @var $em \Doctrine\ORM\EntityManager */
            $em = $args->getEntityManager();

            /** @var $uow \Doctrine\ORM\UnitOfWork */
            $uow = $em->getUnitOfWork();

            $array = array(
                $uow->getScheduledEntityUpdates(),
                $uow->getScheduledEntityDeletions(),
                $uow->getScheduledEntityInsertions(),
                $uow->getScheduledCollectionUpdates(),
                $uow->getScheduledCollectionDeletions(),
                $uow->getScheduledCollectionDeletions(),
                $uow->getScheduledCollectionUpdates()
            );

            foreach ($array as $obj) {
                foreach ($obj as $element) {
                    if ($element instanceof Entity\Message
                     || $element instanceof Entity\MessageTranslation
                    ) {
                        $this->isDirty = true;
                        break 2;
                    }
                }
            }
        }

        $this->flushCache();
    }
467777
public function run(array $args)
    {
        Index::info('Help Menu');
        Index::info('- `eve generate <schema*> <namespace>`    Generates files based on schema');
        Index::info('- `eve database <schema*>`                Generates database table/s schema');
        Index::info('- `eve install`                           Generates default framework files');
        Index::info('- `eve job <name*> <data*>`               Executes a job');
		Index::info('- `eve queue <name*> <data*>`             Queues a job');

        die(0);
    }
657278
public function run(array $args = null)
    {
        global $argv;

        if (isset($argv[1]) && $argv[1] == 'autocomplete' && !isset($argv[2])) {
            $this->setBanner(
                function () {
                    return 0;
                }
            );
            $this->setFooter(
                function () {
                    return 0;
                }
            );
        }

        return parent::run($args);
    }
400814
public function execute(array $args, array $options = [])
    {
        $rootDir = null;
        if (isset($options['root-dir']) && !empty($options['root-dir'])) {
            $rootDir = $options['root-dir'];
        }
        StaticResource::createSymbolicLink($rootDir);
    }
1205754
public function prePersist(LifecycleEventArgs $args): void
    {
        // Get the object and make sure it is what we need.
        $object = $args->getObject();
        if (!$object instanceof PublishableInterface) {
            return;
        }

        // Publish active objects immediately.
        if ($object->isActive()) {
            $object->setPublished(true);
        } else {
            $object->setPublished(false);
        }
    }
1237954
public function postLoad(LifecycleEventArgs $args)
    {
        if ($args->getObject() instanceof BlockInterface && !$args->getObject() instanceof DocumentBlock) {
            $this->getService($args)->postLoad($args->getObject());
        }
    }
852032
public function afterFetch(&$args) {
        $model   = &$args[0];
        $results = &$args[1];
        $select  = &$args[2];
        // In the CMS environment, the translated data is merged into the parent data
        $isCms = $model->isCmsContext();
        if (!$isCms && !$this->_forceI18nOutput) {
            return;
        }
        $iterator = new Garp_Db_Table_Rowset_Iterator(
            $results,
            array($this, 'mergeTranslatedFields')
        );
        $iterator->walk();
    }
1199925
public function run($args)
  {
    $this->args = $args;

    if(isset($this->args['commands'][1])){
      $this->entity($this->args['commands'][1]);
    }
    if(in_array('g',$this->args['flags'])){
      $this->generateEntities();
    }
  }
1362662
public function beforeUpdate(array &$args) {
        $model = $args[0];
        $data = &$args[1];
        $where = $args[2];

        // When updating, it's quite possible {$this->_column} is not in $data.
        // If so, collect it live.
        if (empty($data[$this->_column])) {
            $row = $model->fetchRow($where);
            if ($row->{$this->_column}) {
                $data[$this->_column] = $row->{$this->_column};
            }
        }
        $this->_setBitlyUrl($data);
    }
876117
public function onFlush(OnFlushEventArgs $args): void
    {
        $token = $this->getTokenStorage()->getToken();

        if (!$this->getPermissionManager()->isEnabled()
                || null === $token || $token instanceof ConsoleToken) {
            return;
        }

        $uow = $args->getEntityManager()->getUnitOfWork();
        $createEntities = $uow->getScheduledEntityInsertions();
        $updateEntities = $uow->getScheduledEntityUpdates();
        $deleteEntities = $uow->getScheduledEntityDeletions();

        $this->postResetPermissions = array_merge($createEntities, $updateEntities, $deleteEntities);
        $this->getPermissionManager()->preloadPermissions($this->postResetPermissions);

        $this->checkAllScheduledByAction($createEntities, 'create');
        $this->checkAllScheduledByAction($updateEntities, 'update');
        $this->checkAllScheduledByAction($deleteEntities, 'delete');
    }