Exemplo n.º 1
0
 /**
  * Resolve additional relations
  *
  * @param QueryBuilder $query
  * @param array        $targets
  */
 protected function resolveRelations(QueryBuilder $query, $targets)
 {
     if (!$targets) {
         return;
     }
     foreach ($query->getRelations() as $name => $q) {
         $this->manager->related($targets, $name, $q);
     }
 }
Exemplo n.º 2
0
 /**
  * Removes an entity.
  *
  * @param  object $entity
  * @throws \InvalidArgumentException
  * @return bool
  */
 public function remove($entity)
 {
     $metadata = $this->manager->getMetadata($entity);
     $class = $metadata->getClass();
     $id = $this->getIdentifier($entity);
     if ($id === '') {
         throw new \InvalidArgumentException(sprintf('The entity of class %s is missing an identifier.', $class));
     }
     unset($this->identifiers[spl_object_hash($entity)]);
     if (isset($this->entities[$class][$id])) {
         unset($this->entities[$class][$id]);
         return true;
     }
     return false;
 }
Exemplo n.º 3
0
 /**
  * Returns the database connection for this event.
  *
  * @return Connection
  */
 public function getConnection()
 {
     return $this->manager->getConnection();
 }
Exemplo n.º 4
0
 /**
  * Deletes an entity.
  *
  * @param object $entity
  */
 public function delete($entity)
 {
     $this->manager->delete($entity);
 }