Example #1
0
 /**
  * Adds a model to the identity map.
  *
  * @param Tx_Oelib_Model $model the model to add, must have a UID
  *
  * @return void
  */
 public function add(Tx_Oelib_Model $model)
 {
     if (!$model->hasUid()) {
         throw new InvalidArgumentException('Add() requires a model that has a UID.', 1331488748);
     }
     $this->items[$model->getUid()] = $model;
     $this->highestUid = max($this->highestUid, $model->getUid());
 }
Example #2
0
 /**
  * Finds all records that are related to $model via the field $key.
  *
  * @param Tx_Oelib_Model $model
  *        the model to which the matches should be related
  * @param string $relationKey
  *        the key of the field in the matches that should contain the UID
  *        of $model
  * @param Tx_Oelib_List<Tx_Oelib_Model> $ignoreList
  *        related records that should _not_ be returned
  *
  * @return Tx_Oelib_List<Tx_Oelib_Model> the related models, will be empty if there are no matches
  */
 public function findAllByRelation(Tx_Oelib_Model $model, $relationKey, Tx_Oelib_List $ignoreList = NULL)
 {
     if (!$model->hasUid()) {
         throw new InvalidArgumentException('$model must have a UID.', 1331319915);
     }
     if ($relationKey === '') {
         throw new InvalidArgumentException('$key must not be empty.', 1331319921);
     }
     $ignoreClause = '';
     if ($ignoreList !== NULL && !$ignoreList->isEmpty()) {
         $ignoreUids = $ignoreList->getUids();
         // deals with the case of $ignoreList having only models without UIDs
         if ((string) $ignoreUids !== '') {
             $ignoreClause = ' AND uid NOT IN(' . $ignoreUids . ')';
         }
     }
     return $this->findByWhereClause($relationKey . ' = ' . $model->getUid() . $ignoreClause);
 }
Example #3
0
 /**
  * Sets this model's load status.
  *
  * @param int $status
  *
  * @return void
  */
 public function setLoadStatus($status)
 {
     parent::setLoadStatus($status);
 }
Example #4
0
 /**
  * Marks the parent model as dirty.
  *
  * @internal
  *
  * @return void
  */
 protected function markAsDirty()
 {
     if ($this->parentModel instanceof Tx_Oelib_Model) {
         $this->parentModel->markAsDirty();
     }
 }