コード例 #1
0
 private function createObject($data)
 {
     $table = new ObjectArray();
     foreach ($data as $key => $value) {
         $table->setColName($key, $value);
     }
     return $table;
 }
コード例 #2
0
ファイル: Reserve.php プロジェクト: vmrose/clientlibrary
 /**
  * Add Basket Item the the basketItems field
  * @see Reserve::basketItems
  * @param BasketItem $item
  * @return $this
  */
 public function addBasketItem(BasketItem $item)
 {
     if (empty($this->basketItems)) {
         $this->basketItems = new ObjectArray();
     }
     $this->basketItems->append($item);
     return $this;
 }
コード例 #3
0
ファイル: immutable.php プロジェクト: nooku/nooku-framework
 /**
  * Constructor
  *
  * @param  ObjectConfig $config  An optional ObjectConfig object with configuration options.
  */
 public function __construct(ObjectConfig $config)
 {
     ObjectArray::__construct($config);
     $this->_identity_key = $config->identity_key;
     //Set the status
     if (isset($config->status)) {
         $this->_status = $config->status;
     }
     // Set the entity data
     if (isset($config->data)) {
         $this->_data = $config->data->toArray();
     } else {
         $this->_data = array();
     }
     //Set the status message
     if (!empty($config->status_message)) {
         $this->_status_message = $config->status_message;
     }
 }
コード例 #4
0
ファイル: message.php プロジェクト: nooku/nooku-framework
 /**
  * Unset an item in the array
  *
  * Required by interface ArrayAccess
  *
  * @param   int     $offset
  * @return  void
  */
 public function offsetUnset($offset)
 {
     ObjectArray::offsetUnset($offset);
 }
コード例 #5
0
ファイル: state.php プロジェクト: nooku/nooku-framework
 /**
  * Initializes the options for the object
  *
  * Called from {@link __construct()} as a first step of object instantiation.
  *
  * @param   ObjectConfig $config An optional ObjectConfig object with configuration options
  */
 protected function _initialize(ObjectConfig $config)
 {
     $config->append(array('model' => null, 'defaults' => array()));
     parent::_initialize($config);
 }
コード例 #6
0
ファイル: abstract.php プロジェクト: nooku/nooku-framework
 /**
  * Return an associative array of the data
  *
  * Skip the properties that start with an underscore as they are considered private
  *
  * @return array
  */
 public function toArray()
 {
     $data = parent::toArray();
     foreach ($this->getComputedProperties() as $property) {
         if ($this->{$property} instanceof ModelEntityInterface) {
             $data[$property] = array_values($this->{$property}->toArray());
         } else {
             $data[$property] = $this->{$property};
         }
     }
     foreach (array_keys($data) as $key) {
         if (substr($key, 0, 1) === '_') {
             unset($data[$key]);
         }
     }
     return $data;
 }
コード例 #7
0
 /**
  * Initializes the options for the object
  *
  * Called from {@link __construct()} as a first step of object instantiation.
  *
  * @param   ObjectConfig $object An optional ObjectConfig object with configuration options
  * @return  void
  */
 protected function _initialize(ObjectConfig $config)
 {
     $config->append(array('parameters' => array()));
     parent::_initialize($config);
 }
コード例 #8
0
ファイル: abstract.php プロジェクト: janssit/nickys.janss.be
 /**
  * Initializes the options for the object
  *
  * Called from {@link __construct()} as a first step of object instantiation.
  *
  * @param   ObjectConfig $object An optional ObjectConfig object with configuration options
  * @return  void
  */
 protected function _initialize(ObjectConfig $config)
 {
     $config->append(array('namespace' => '__nooku_' . $this->getIdentifier()->name, 'separator' => '.'));
     parent::_initialize($config);
 }
コード例 #9
0
ファイル: abstract.php プロジェクト: nooku/nooku-framework
 /**
  * Search the mixin method map and call the method or trigger an error
  *
  * This function implements a just in time mixin strategy. Available table behaviors are only mixed when needed.
  * Lazy mixing is triggered by calling DatabaseRowsetTable::is[Behaviorable]();
  *
  * @param  string     $method    The function name
  * @param  array      $arguments The function arguments
  * @throws \BadMethodCallException     If method could not be found
  * @return mixed The result of the function
  */
 public function __call($method, $arguments)
 {
     if ($this->isConnected()) {
         $parts = StringInflector::explode($method);
         //Check if a behavior is mixed
         if ($parts[0] == 'is' && isset($parts[1])) {
             if (!$this->isMixedMethod($method)) {
                 //Lazy mix behaviors
                 $behavior = strtolower($parts[1]);
                 if ($this->getTable()->hasBehavior($behavior)) {
                     $this->mixin($this->getTable()->getBehavior($behavior));
                 } else {
                     return false;
                 }
             }
         }
     }
     return parent::__call($method, $arguments);
 }
コード例 #10
0
ファイル: abstract.php プロジェクト: janssit/nickys.janss.be
 /**
  * Remove a row field
  *
  * @param   string  $column The column name.
  * @return  void
  */
 public function offsetUnset($column)
 {
     parent::offsetUnset($column);
     unset($this->_modified[$column]);
 }