/** * @param BeanPropertyListener $beanPropertyListener */ public function setBeanPropertyListener(BeanPropertyListener $beanPropertyListener) { if ($beanPropertyListener === $this->beanPropertyListener) { return; } $this->beanPropertyListener = $beanPropertyListener; $beanPropertiesToInject = []; $registers = $this->beanPropertyListener->getRegisters(); foreach ($registers as $eventName => $className) { $propertyName = explode('.', $eventName); $propertyName = $propertyName[count($propertyName) - 1]; $validation = $className::getValidation(); if ($validation === null) { continue; } $beanPropertiesToInject[$propertyName] = $validation; } $this->yamlarh->addAccessibleVariable(self::YAMLARHBEANPROPERTY, $beanPropertiesToInject); }
/** * */ public function loadContext() { $this->beforeLoad(); $this->getLogger()->info("Starting loading context..."); $this->loadYamlarh($this->filename); $this->filename = realpath($this->yamlarh->getFilename()); $this->contextRoot = dirname(realpath($this->yamlarh->getFilename())); $this->extender->addExtendFromFile($this->contextRoot . '/' . $this->extender->getDefaultFilename()); $this->extender->extend(); $this->sphringEventDispatcher->dispatch(SphringEventEnum::SPHRING_BEFORE_LOAD, new EventSphring($this)); if (empty($this->yamlarh->getFilename())) { throw new SphringException("Cannot load context, file '%s' doesn't exist in root project '%s'", $this->filename, $this->getRootProject()); } $this->yamlarh->addAccessibleVariable(SphringYamlarhConstantEnum::CONTEXTROOT, $this->contextRoot); $this->getLogger()->info(sprintf("Loading context '%s' ...", realpath($this->yamlarh->getFilename()))); $this->parseYaml(); $this->sphringEventDispatcher->dispatch(SphringEventEnum::SPHRING_START_LOAD, new EventSphring($this)); $this->loadBeans(); $this->sphringEventDispatcher->dispatchQueue(); $this->sphringEventDispatcher->dispatch(SphringEventEnum::SPHRING_FINISHED_LOAD, new EventSphring($this)); }