Example #1
0
 /**
  * Efface l'entité en base de donnée
  * @return boolean
  */
 public function remove()
 {
     $field = $this->_storage->get($this->_config->getPrimaryKey());
     $value = $field->getValue();
     // Si la valeur est vide
     if (empty($value)) {
         return FALSE;
     }
     // Exécute la requête
     return $this->db()->where($field->getName(), $value)->delete($this->_config->getTable());
 }
Example #2
0
 /**
  * Créer une jointure en SQL
  * @param \Origami\Entity $entity
  * @param string|null $cond
  * @param string|null $type
  * @param string|null $escape
  * @return \Origami\Entity\Manager\Query
  */
 public function join($entity, $cond = NULL, $type = NULL, $escape = NULL)
 {
     if ($cond === NULL) {
         $cond = "{$entity::table()}.{$this->config->getTable()}_{$this->config->getPrimaryKey()} = {$this->config->getTable()}.{$this->config->getPrimaryKey()}";
     }
     if ($type === NULL) {
         $type = "";
     }
     \Origami\DB::get($this->config->getDataBase())->join($entity::table(), $cond, $type, $escape);
     return $this;
 }
Example #3
0
 /**
  * Modifie le nom de la clé primaire
  * @param \Origami\Entity\Manager\Config $config
  */
 public function setName(\Origami\Entity\Manager\Config &$config)
 {
     $this->name = $config->getPrimaryKey();
 }