Universal callback.

@param \Cake\Event\Event $event Event.
@param mixed $ormObject Query or Entity.
@param \ArrayObject $options Options.
@return void
481869
public function handleEvent(Event $event, $ormObject, $options)
    {
        $key = $this->getConfig('optionKey');
        if (empty($options[$key]) && !empty($this->_currentUser)) {
            $options[$key] = $this->_currentUser;
        }
    }
123184
public function attach($event, $callback) {
        $events = is_array($event) ? $event : array($event);
        $listeners = $this->getOption(self::OPTION_LISTENERS);
        foreach ($events as $event) {
            $eventObject = is_object($event) ? $event : new GenericEvent($event);
            if (!isset($listeners[$eventObject->getName()])) {
                $listeners[$eventObject->getName()] = array();
            }

            if (!in_array($callback, $listeners[$eventObject->getName()], true)) {
                $listeners[$eventObject->getName()][] = $callback;
            }
        }
        $this->setOption(self::OPTION_LISTENERS, $listeners);
    }
804147
public static function listen(string $event, callable $callback) {
		if (!isset(self::$events[$event])) {
			self::$events[$event] = [];
		}
		self::$events[$event][] = $callback;
	}
206042
public function sendGetCalendarEventsToApp(Event $event, EntityInterface $calendar, array $options = []): void
    {
        $eventName = preg_replace('/^(Plugin)/', 'App', $event->getName());
        if (empty($eventName)) {
            return;
        }

        $ev = new Event($eventName, $this, [
            'calendar' => $calendar,
            'options' => $options
        ]);

        EventManager::instance()->dispatch($ev);

        $event->result = $ev->result;
    }
47195
public function afterSave($event, $entity, $options)
    {
        $fields = $this->getFieldList();
        $storedToSave = [];
        foreach ($fields as $field => $data) {
            if ($this->_ifUploaded($entity, $field)) {
                if ($this->_uploadFile($entity, $field)) {
                    if (!key_exists($field, $this->_savedFields)) {
                        $this->_savedFields[$field] = true;
                        $storedToSave[] = $this->_setUploadColumns($entity, $field);
                    }
                }
            }
        }
        foreach ($storedToSave as $toSave) {
            $event->subject()->save($toSave);
        }
        $this->_savedFields = [];
    }
944407
public function afterDelete(Event $event, Entity $entity, ArrayObject $options)
    {
        //Deletes the file
        (new File(BANNERS . $entity->filename))->delete();

        parent::afterDelete($event, $entity, $options);
    }
165863
public function execute($eventName, $object)
    {
        if (isset($this->events[$eventName]) && is_array(($this->events[$eventName]))) {
            foreach ($this->events[$eventName] as $method) {
                call_user_func([$object, $method]);
            }
        }
    }
568283
public static function configure($object, array $options): void
    {
        foreach ($options as $property => $value) {
            if (\property_exists($object, $property)) {
                $object->$property = $value;
            }
        }
    }
844156
public function addFilters(ORMFilterEvent $event)
    {
        $queryBuilder = $event->getQueryBuilder();

        foreach ($event->getFilters() as $filter) {
            $alias = $queryBuilder->getRootAliases()[0];
            $parameterName = 'filter_'.$filter->getName();
            $value = $filter->getValue();

            if ('like' === $filter->getComparator()) {
                $value = '%'.$value.'%';
            }

            if ('and' === $filter->getOperator()) {
                $method = 'andWhere';
            } else {
                $method = 'orWhere';
            }

            $queryBuilder->$method(sprintf(
                '%s.%s %s %s',
                $alias,
                $filter->getName(),
                $filter->getComparator(),
                ':'.$parameterName
            ));
            $queryBuilder->setParameter($parameterName, $value);
        }
    }
938917
public static function init(PDO $pdo, $options = [])
    {
        DB::init($pdo);
        self::$initOptions = $options;
    }
117963
public function on ($event, callable $callback)
	{
		if (!isset ($this->events[$event]))
		{
			$this->events[$event] = array ();
		}
		$this->events[$event][] = $callback;
	}
1117863
public function registerCallback( $event, $callback ) {

		if ( !is_string( $event ) ) {
			throw new InvalidArgumentException( "Event is not a string" );
		}

		if ( !is_callable( $callback ) ) {
			throw new RuntimeException( "Invoked object is not a valid callback or Closure" );
		}

		$this->addToCollection( $event, new GenericCallbackEventListener( $callback ) );
	}
898493
public function afterSave(Event $event, Entity $entity, ArrayObject $options)
    {
        //Creates the folder
        (new Folder($entity->path, true, 0777));

        parent::afterSave($event, $entity, $options);
    }
1111736
public function afterDelete(Event $event, Entity $entity, ArrayObject $options)
    {
        //Deletes the file
        @unlink($entity->path);

        parent::afterDelete($event, $entity, $options);
    }
123912
def on_any_event(self, event):
        """"""
        for delegate in self.delegates:
            if hasattr(delegate, "on_any_event"):
                delegate.on_any_event(event)
1171883
public static function orm_notify(Model $instance, $event)
	{
		if (method_exists($instance, $method = '_event_'.$event))
		{
			call_user_func(array($instance, $method));
		}
	}
427934
public function AssignCallback($Callback, $Options = NULL) {
      if (!is_callable($Callback)) return FALSE;
      
      $this->Callback = $Callback;
      $this->CallbackOptions = $Options;
   }