Exemple #1
0
 /**
  * @see AnDomainQuery::where
  * 
  * @return AnDomainQueryClause
  */
 public function where($key, $constraint = null, $value = null, $condition = 'AND')
 {
     $handle = $this->getHandle();
     $this->_internal_query->where($key, $constraint, $value, $condition);
     if (!isset($this->_parent_query->where[$handle])) {
         $this->_parent_query->where[$handle] = array('clause' => $this, 'condition' => $this->_condition);
     }
     return $this;
 }
Exemple #2
0
 /**
  * Builds an delete query. Handles multiple resources at once.
  *
  * @param AnDomainQuery $query Query object
  * 
  * @return string
  */
 public function delete($query)
 {
     $resources = $query->getRepository()->getResources();
     foreach ($resources->getLinks() as $link) {
         $query->where($link->child, '=', $link->parent);
     }
     $names = array();
     foreach ($resources as $resource) {
         $query->from($resource->getName() . ' AS ' . $this->_store->quoteName($resource->getAlias()));
         $names[] = $this->_store->quoteName($resource->getAlias());
     }
     $clause = 'DELETE ' . implode(', ', $names);
     return $clause;
 }