Exemple #1
0
 /**
  * Modify the value in this cell
  * @param mixed $data
  * @param string $op a specific operator
  * @return \pq\Gateway\Cell
  */
 function mod($data, $op = null)
 {
     if (is_string($data)) {
         $data = $this->row->getTable()->getConnection()->quote($data);
     }
     parent::mod($data, $op);
     $this->dirty = true;
     return $this;
 }
Exemple #2
0
 /**
  * Get the parent rows of a row by foreign key
  * @param \pq\Gateway\Row $foreign
  * @param string $ref
  * @return mixed
  */
 function by(Row $foreign, $ref = null)
 {
     // select * from $this where $this->$referencedColumn = $me->$foreignColumn
     if (!($rel = $foreign->getTable()->getRelation($this->getName(), $ref))) {
         return $this->onResult(null);
     }
     $where = array();
     foreach ($rel as $key => $ref) {
         $where["{$ref}="] = $foreign->{$key};
     }
     return $this->find($where);
 }