Exemplo n.º 1
0
 /**
  * @param $model
  *
  * @return \arStorage
  */
 public static function getInstance(&$model)
 {
     /**
      * @var $storage arStorage
      */
     arFieldCache::storeFromStorage(get_called_class(), $model);
     $storage = self::getCalledClass();
     $method = self::_toCamelCase('get_' . $storage->getArFieldList()->getPrimaryFieldName());
     $storage->setExternalModelForStorage($model);
     $storage->{$storage->getArFieldList()->getPrimaryFieldName()} = $model->{$method}();
     if ($storage->{$storage->getArFieldList()->getPrimaryFieldName()}) {
         $storage->read();
     }
     $storage->mapFromActiveRecord();
     return $storage;
 }
Exemplo n.º 2
0
 /**
  * @param ActiveRecord $ar
  */
 public function delete(ActiveRecord $ar)
 {
     $ilDB = $this->returnDB();
     $ilDB->manipulate('DELETE FROM ' . $ar->getConnectorContainerName() . ' WHERE ' . arFieldCache::getPrimaryFieldName($ar) . ' = ' . $ilDB->quote($ar->getPrimaryFieldValue(), arFieldCache::getPrimaryFieldType($ar)));
 }
Exemplo n.º 3
0
 /**
  * @param int         $primary_key
  * @param arConnector $connector
  */
 public function __construct($primary_key = 0, arConnector $connector = NULL)
 {
     if ($connector == NULL) {
         $connector = new arConnectorDB();
     }
     //$this->arConnector = $connector;
     arConnectorMap::register($this, $connector);
     $arFieldList = arFieldCache::get($this);
     //$this->arFieldList = $arFieldList ;
     $key = $arFieldList->getPrimaryFieldName();
     $this->{$key} = $primary_key;
     if ($primary_key !== 0 and $primary_key !== NULL and $primary_key !== false) {
         $this->read();
     }
 }
Exemplo n.º 4
0
 /**
  * @param int         $primary_key
  * @param arConnector $connector
  */
 public function __construct($primary_key = 0, arConnector $connector = NULL)
 {
     if ($connector == NULL) {
         $this->arConnector = new arConnectorDB();
     } else {
         $this->arConnector = $connector;
     }
     $this->arFieldList = arFieldCache::get($this);
     $key = $this->arFieldList->getPrimaryFieldName();
     $this->{$key} = $primary_key;
     if ($primary_key !== 0 and $primary_key !== NULL and $primary_key !== false) {
         $this->read();
     }
 }
Exemplo n.º 5
0
 /**
  * @return arViewField
  */
 public function getPrimaryField()
 {
     return $this->getField(arFieldCache::getPrimaryFieldName($this->active_record));
 }