/** * Sets find query value for many-to-many related objects. * * Manipulates the find $query for objects related to the object defined in * $objectState, defined my the relation $relation. * * @param ezcQuery $query * @param ezcPersistentObjectDefinition $def * @param ezcPersistentManyToManyRelation $relation * @param array $objectState */ private function createComplexRelationFindQuery(ezcQuery $query, ezcPersistentObjectDefinition $def, ezcPersistentManyToManyRelation $relation, array $objectState) { $db = $this->database; $relationTableQuoted = $db->quoteIdentifier($relation->relationTable); // Join with relation table. $query->from($relationTableQuoted); foreach ($relation->columnMap as $map) { $query->where($query->expr->eq($relationTableQuoted . "." . $db->quoteIdentifier($map->relationSourceColumn), $query->bindValue($objectState[$def->columns[$map->sourceColumn]->propertyName], null, $def->columns[$map->sourceColumn]->databaseType)), $query->expr->eq($relationTableQuoted . "." . $db->quoteIdentifier($map->relationDestinationColumn), $db->quoteIdentifier($relation->destinationTable) . "." . $db->quoteIdentifier($map->destinationColumn))); } }
/** * Limits the given $query to the subtree starting at $rootLocationId * * @param \ezcQuery $query * @param string $rootLocationId * * @return void */ protected function applySubtreeLimitation(\ezcQuery $query, $rootLocationId) { $query->where($query->expr->like($this->handler->quoteColumn('path_string', 'ezcontentobject_tree'), $query->bindValue('%/' . $rootLocationId . '/%'))); }