Neos\Media\Domain\Model\Asset::initializeObject PHP Метод

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

public initializeObject ( integer $initializationCause ) : void
$initializationCause integer
Результат void
    public function initializeObject($initializationCause)
    {
        // FIXME: This is a workaround for after the resource management changes that introduced the property.
        if ($this->thumbnails === null) {
            $this->thumbnails = new ArrayCollection();
        }
        if ($initializationCause === ObjectManagerInterface::INITIALIZATIONCAUSE_CREATED) {
            $this->emitAssetCreated($this);
        }
    }

Usage Example

 /**
  * 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();
     }
 }
All Usage Examples Of Neos\Media\Domain\Model\Asset::initializeObject