initializeObject() публичный метод

public initializeObject ( integer $initializationCause ) : void
$initializationCause integer
Результат void
 /**
  * Initialize this image variant
  *
  * This method will generate the resource of this asset when this object has just been newly created.
  * We can't run renderResource() in the constructor since not all dependencies have been injected then. Generating
  * resources lazily in the getResource() method is not feasible either, because getters will be triggered
  * by the validation mechanism on flushing the persistence which will result in undefined behavior.
  *
  * We don't call refresh() here because we only want the resource to be rendered, not all other refresh actions
  * from parent classes being executed.
  *
  * @param integer $initializationCause
  * @return void
  */
 public function initializeObject($initializationCause)
 {
     parent::initializeObject($initializationCause);
     if ($initializationCause === ObjectManagerInterface::INITIALIZATIONCAUSE_CREATED) {
         $this->renderResource();
     }
 }
Пример #2
0
 /**
  * @param integer $initializationCause
  * @throws ImageFileException
  * @return void
  */
 public function initializeObject($initializationCause)
 {
     // FIXME: This is a workaround for after the resource management changes that introduced the property.
     if ($this->variants === null) {
         $this->variants = new ArrayCollection();
     }
     if ($initializationCause === ObjectManagerInterface::INITIALIZATIONCAUSE_CREATED) {
         $this->calculateDimensionsFromResource($this->resource);
     }
     parent::initializeObject($initializationCause);
 }