本文整理汇总了PHP中Expression::andChain方法的典型用法代码示例。如果您正苦于以下问题:PHP Expression::andChain方法的具体用法?PHP Expression::andChain怎么用?PHP Expression::andChain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Expression
的用法示例。
在下文中一共展示了Expression::andChain方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: makeSqlSelectQuery
/**
* @return ISqlSelectQuery
*/
private function makeSqlSelectQuery(EntityQuery $query)
{
$query = $query->toSelectQuery();
$joinMethod = SqlJoinMethod::INNER;
$childrenTable = $this->getChildren()->getPhysicalSchema()->getTable();
$proxyTable = $this->mtm->getProxy()->getPhysicalSchema()->getTable();
$condition = Expression::andChain();
$srcSqlFields = $this->getChildren()->getLogicalSchema()->getIdentifier()->getFields();
$dstSqlFields = $this->mtm->getEncapsulantProxyProperty()->getFields();
foreach ($srcSqlFields as $k => $v) {
$condition->add(Expression::eq(new SqlColumn($srcSqlFields[$k], $childrenTable), new SqlColumn($dstSqlFields[$k], $proxyTable)));
}
$query->join(new SqlConditionalJoin(new SelectQuerySource(new SqlIdentifier($proxyTable)), new SqlJoinMethod($joinMethod), $condition));
$columnName = $this->mtm->getContainerProxyProperty()->getField();
$query->andWhere(Expression::eq(new SqlColumn($columnName, $this->mtm->getProxy()->getPhysicalSchema()->getTable()), new SqlValue($this->getParentObject()->_getId())));
return $query;
}
示例2: join
/**
* @return void
*/
private function join(OrmProperty $property, AssociationPropertyType $type, EntityQueryBuilder $builder, SelectQuerySource $source)
{
$joinMethod = $type->getAssociationMultiplicity()->is(AssociationMultiplicity::EXACTLY_ONE) ? SqlJoinMethod::INNER : SqlJoinMethod::LEFT;
$condition = Expression::andChain();
$srcSqlFields = $property->getFields();
$dstSqlFields = $builder->entity->getLogicalSchema()->getIdentifier()->getFields();
foreach ($srcSqlFields as $k => $v) {
$condition->add(Expression::eq(new SqlColumn($srcSqlFields[$k], $this->alias), new SqlColumn($dstSqlFields[$k], $builder->alias)));
}
$source->join(new SqlConditionalJoin(new SelectQuerySource(new AliasedSqlValueExpression(new SqlIdentifier($builder->table), $builder->alias)), new SqlJoinMethod($joinMethod), $condition));
}