本文整理汇总了PHP中ModelJoin类的典型用法代码示例。如果您正苦于以下问题:PHP ModelJoin类的具体用法?PHP ModelJoin怎么用?PHP ModelJoin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ModelJoin类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: testSetRelationMapComposite
public function testSetRelationMapComposite()
{
$table = ReaderFavoritePeer::getTableMap();
$join = new ModelJoin();
$join->setTableMap($table);
$join->setRelationMap($table->getRelation('BookOpinion'));
$this->assertEquals(array(ReaderFavoritePeer::BOOK_ID, ReaderFavoritePeer::READER_ID), $join->getLeftColumns(), 'setRelationMap() automatically sets the left columns for composite relationships');
$this->assertEquals(array(BookOpinionPeer::BOOK_ID, BookOpinionPeer::READER_ID), $join->getRightColumns(), 'setRelationMap() automatically sets the right columns for composite relationships');
}
开发者ID:ketheriel,项目名称:ETVA,代码行数:9,代码来源:ModelJoinTest.php
示例2: init
/**
* Define the joined hydration schema based on a join object.
* Fills the ModelWith properties using a ModelJoin as source
*
* @param ModelJoin $join
*/
public function init(ModelJoin $join)
{
$tableMap = $join->getTableMap();
$this->modelName = $tableMap->getClassname();
$this->modelPeerName = $tableMap->getPeerClassname();
$this->isSingleTableInheritance = $tableMap->isSingleTableInheritance();
$relation = $join->getRelationMap();
if ($relation->getType() == RelationMap::ONE_TO_MANY) {
$this->isAdd = true;
$this->relationName = $relation->getName() . 's';
$this->relationMethod = 'add' . $relation->getName();
} else {
$this->relationName = $relation->getName();
$this->relationMethod = 'set' . $relation->getName();
}
$this->rightPhpName = $join->hasRelationAlias() ? $join->getRelationAlias() : $relation->getName();
if (!$join->isPrimary()) {
$this->leftPhpName = $join->hasLeftTableAlias() ? $join->getLeftTableAlias() : $join->getPreviousJoin()->getRelationMap()->getName();
}
}
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:26,代码来源:ModelWith.php
示例3: joinProduct
/**
* Adds a JOIN clause to the query using the Product relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return OrganizationProductQuery The current query, for fluid interface
*/
public function joinProduct($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('Product');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if ($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'Product');
}
return $this;
}
开发者ID:Halfnhav4,项目名称:datawrapper,代码行数:28,代码来源:BaseOrganizationProductQuery.php
示例4: join
/**
* Adds a JOIN clause to the query
* Infers the ON clause from a relation name
* Uses the Propel table maps, based on the schema, to guess the related columns
* Beware that the default JOIN operator is INNER JOIN, while Criteria defaults to WHERE
* Examples:
* <code>
* $c->join('Book.Author');
* => $c->addJoin(BookPeer::AUTHOR_ID, AuthorPeer::ID, Criteria::INNER_JOIN);
* $c->join('Book.Author', Criteria::RIGHT_JOIN);
* => $c->addJoin(BookPeer::AUTHOR_ID, AuthorPeer::ID, Criteria::RIGHT_JOIN);
* $c->join('Book.Author a', Criteria::RIGHT_JOIN);
* => $c->addAlias('a', AuthorPeer::TABLE_NAME);
* => $c->addJoin(BookPeer::AUTHOR_ID, 'a.ID', Criteria::RIGHT_JOIN);
* </code>
*
* @param string $relation Relation to use for the join
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return ModelCriteria The current object, for fluid interface
*
* @throws PropelException
*/
public function join($relation, $joinType = Criteria::INNER_JOIN)
{
// relation looks like '$leftName.$relationName $relationAlias'
list($fullName, $relationAlias) = self::getClassAndAlias($relation);
if (strpos($fullName, '.') === false) {
// simple relation name, refers to the current table
$leftName = $this->getModelAliasOrName();
$relationName = $fullName;
$previousJoin = $this->getPreviousJoin();
$tableMap = $this->getTableMap();
} else {
list($leftName, $relationName) = explode('.', $fullName);
// find the TableMap for the left table using the $leftName
if ($leftName == $this->getModelAliasOrName()) {
$previousJoin = $this->getPreviousJoin();
$tableMap = $this->getTableMap();
} elseif (isset($this->joins[$leftName])) {
$previousJoin = $this->joins[$leftName];
$tableMap = $previousJoin->getTableMap();
} else {
throw new PropelException('Unknown table or alias ' . $leftName);
}
}
$leftTableAlias = isset($this->aliases[$leftName]) ? $leftName : null;
// find the RelationMap in the TableMap using the $relationName
if (!$tableMap->hasRelation($relationName)) {
throw new PropelException('Unknown relation ' . $relationName . ' on the ' . $leftName . ' table');
}
$relationMap = $tableMap->getRelation($relationName);
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
if (null !== $previousJoin) {
$join->setPreviousJoin($previousJoin);
}
$join->setRelationMap($relationMap, $leftTableAlias, $relationAlias);
// add the ModelJoin to the current object
if ($relationAlias !== null) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, $relationName);
}
return $this;
}
开发者ID:kcornejo,项目名称:estadistica,代码行数:68,代码来源:ModelCriteria.php
示例5: testUseFkQueryTwiceTwoAliases
public function testUseFkQueryTwiceTwoAliases()
{
$q = BookQuery::create()->useAuthorQuery('a')->filterByFirstName('Leo')->endUse()->useAuthorQuery('b')->filterByLastName('Tolstoi')->endUse();
$join1 = new ModelJoin();
$join1->setJoinType(Criteria::LEFT_JOIN);
$join1->setTableMap(AuthorPeer::getTableMap());
$join1->setRelationMap(BookPeer::getTableMap()->getRelation('Author'), null, 'a');
$join1->setRelationAlias('a');
$join2 = new ModelJoin();
$join2->setJoinType(Criteria::LEFT_JOIN);
$join2->setTableMap(AuthorPeer::getTableMap());
$join2->setRelationMap(BookPeer::getTableMap()->getRelation('Author'), null, 'b');
$join2->setRelationAlias('b');
$q1 = BookQuery::create()->addAlias('a', AuthorPeer::TABLE_NAME)->addJoinObject($join1, 'a')->add('a.FIRST_NAME', 'Leo', Criteria::EQUAL)->addAlias('b', AuthorPeer::TABLE_NAME)->addJoinObject($join2, 'b')->add('b.LAST_NAME', 'Tolstoi', Criteria::EQUAL);
$this->assertTrue($q->equals($q1), 'useFkQuery() called twice on the same relation with two aliases creates two joins');
}
开发者ID:shelsonjava,项目名称:datawrapper,代码行数:16,代码来源:QueryBuilderTest.php
示例6: getGroupeFormatter
/**
* PropelFormatter pour la requete sql directe
*
* @return PropelFormatter pour le requete getGroupe
*/
private static function getGroupeFormatter() {
if (UtilisateurProfessionnel::$groupeFormatter === null) {
$formatter = new PropelObjectFormatter();
$formatter->setDbName(GroupePeer::DATABASE_NAME);
$formatter->setClass('Groupe');
$formatter->setPeer('GroupePeer');
$formatter->setAsColumns(array());
$formatter->setHasLimit(false);
$groupeTableMap = Propel::getDatabaseMap(GroupePeer::DATABASE_NAME)->getTableByPhpName('Groupe');
$width = array();
// create a ModelJoin object for this join
$j_groupes_classesJoin = new ModelJoin();
$j_groupes_classesJoin->setJoinType(Criteria::LEFT_JOIN);
$j_groupes_classesRelation = $groupeTableMap->getRelation('JGroupesClasses');
$j_groupes_classesJoin->setRelationMap($j_groupes_classesRelation);
$width["JGroupesClasses"] = new ModelWith($j_groupes_classesJoin);
$classeJoin = new ModelJoin();
$classeJoin->setJoinType(Criteria::LEFT_JOIN);
$jGroupesClassesTableMap = Propel::getDatabaseMap(GroupePeer::DATABASE_NAME)->getTableByPhpName('JGroupesClasses');
$relationClasse = $jGroupesClassesTableMap->getRelation('Classe');
$classeJoin->setRelationMap($relationClasse);
$classeJoin->setPreviousJoin($j_groupes_classesJoin);
$width["Classe"] = new ModelWith($classeJoin);
$formatter->setWith($width);
UtilisateurProfessionnel::$groupeFormatter = $formatter;
}
return UtilisateurProfessionnel::$groupeFormatter;
}
开发者ID:rhertzog,项目名称:lcs,代码行数:36,代码来源:UtilisateurProfessionnel.php
示例7: getTraitementFormatter
/**
* PropelFormatter pour la requete sql directe
*
* @return PropelFormatter pour le requete getGroupe
*/
private static function getTraitementFormatter() {
if (AbsenceEleveSaisie::$traitementFormatter === null) {
$formatter = new PropelObjectFormatter();
$formatter->setDbName(AbsenceEleveTraitementPeer::DATABASE_NAME);
$formatter->setClass('AbsenceEleveTraitement');
$formatter->setPeer('AbsenceEleveTraitementPeer');
$formatter->setAsColumns(array());
$formatter->setHasLimit(false);
$typeTableMap = Propel::getDatabaseMap(AbsenceEleveTraitementPeer::DATABASE_NAME)->getTableByPhpName('AbsenceEleveTraitement');
$width = array();
// create a ModelJoin object for this join
$typeJoin = new ModelJoin();
$typeJoin->setJoinType(Criteria::LEFT_JOIN);
$typeRelation = $typeTableMap->getRelation('AbsenceEleveType');
$typeJoin->setRelationMap($typeRelation);
$width["AbsenceEleveType"] = new ModelWith($typeJoin);
$notificationJoin = new ModelJoin();
$notificationJoin->setJoinType(Criteria::LEFT_JOIN);
$notificationRelation = $typeTableMap->getRelation('AbsenceEleveNotification');
$notificationJoin->setRelationMap($notificationRelation);
$width["AbsenceEleveNotification"] = new ModelWith($notificationJoin);
$justificationJoin = new ModelJoin();
$justificationJoin->setJoinType(Criteria::LEFT_JOIN);
$justificationRelation = $typeTableMap->getRelation('AbsenceEleveJustification');
$justificationJoin->setRelationMap($justificationRelation);
$width["AbsenceEleveJustification"] = new ModelWith($justificationJoin);
$formatter->setWith($width);
AbsenceEleveSaisie::$traitementFormatter = $formatter;
}
return AbsenceEleveSaisie::$traitementFormatter;
}
开发者ID:rhertzog,项目名称:lcs,代码行数:40,代码来源:AbsenceEleveSaisie.php
注:本文中的ModelJoin类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论