/**
  * Object constructor.
  *
  * @param HasManyAssociation Typ asociace mozne jsou [ TODO ]
  * @param \dbrecord\Entity Vlastnik, ke ktere kolekce patri.
  */
 public function __construct(HasManyAssociation $association, DbRecord $owner)
 {
     $this->association = $association;
     $this->belongsToRecord = $owner;
     $class = $association->getReferenceClass();
     parent::__construct($class);
 }
Exemple #2
0
 protected function saveHasManyAssociatedObject(HasManyAssociation $association, Entity $record, $value, $construction = array())
 {
     if (is_array($value)) {
         $class = $association->getReferenceClass();
         $objects = array();
         foreach ($value as $v) {
             $objects[] = new $class($v, NULL, $construction);
         }
         // ocekavame ze se jedna o vice objektu a budeme vytvaret AssociatedCollection
         $aclass = $association->getAssociatedCollectionClass();
         $aobject = new $aclass($this, $record);
         $aobject->import($objects);
         // memory leaks - nekde tady je
         $class = $objects = $value = $v = $construction = NULL;
         return $aobject;
     } else {
         return $value;
     }
 }