Exemplo n.º 1
0
 /**
  * @see Component::staticContainer()
  * @param array           $fields
  * @param EntityInterface $parent
  * @param ODM             $odm
  * @param array           $odmSchema
  */
 public function __construct($fields = [], EntityInterface $parent = null, ODM $odm = null, $odmSchema = null)
 {
     parent::__construct($fields, $parent, $odm, $odmSchema);
     if (!$this->isLoaded() && !$this->isEmbedded()) {
         //Document is newly created instance
         $this->solidState(true)->invalidate();
     }
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function __construct($fields = [], EntityInterface $parent = null, ODM $odm = null, $odmSchema = null)
 {
     if (is_string($fields)) {
         try {
             $fields = json_decode($fields, true);
         } catch (\ErrorException $exception) {
             $fields = [];
         }
     }
     parent::__construct($fields, $parent, $odm, $odmSchema);
 }