本文整理汇总了PHP中BasePeer::doCount方法的典型用法代码示例。如果您正苦于以下问题:PHP BasePeer::doCount方法的具体用法?PHP BasePeer::doCount怎么用?PHP BasePeer::doCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BasePeer
的用法示例。
在下文中一共展示了BasePeer::doCount方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doCount
public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
{
$criteria = clone $criteria;
$criteria->setPrimaryTableName(ProductPeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
ProductPeer::addSelectColumns($criteria);
}
$criteria->clearOrderByColumns();
$criteria->setDbName(self::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(ProductPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
foreach (sfMixer::getCallables('BaseProductPeer:doCount:doCount') as $callable) {
call_user_func($callable, 'BaseProductPeer', $criteria, $con);
}
$stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$count = (int) $row[0];
} else {
$count = 0;
}
$stmt->closeCursor();
return $count;
}
示例2: testDoCount
public function testDoCount()
{
try {
$c = new Criteria();
$c->add(BookPeer::ID, 12, ' BAD SQL');
BookPeer::addSelectColumns($c);
BasePeer::doCount($c);
} catch (PropelException $e) {
$this->assertContains('[SELECT COUNT(*) FROM `book` WHERE book.ID BAD SQL:p1]', $e->getMessage(), 'SQL query is written in the exception message');
}
}
示例3: checkForRepeatedNames
public function checkForRepeatedNames($validator, $value)
{
$criteria = new Criteria();
$criteria->add(QubitTerm::ID, $this->resource->id, Criteria::NOT_EQUAL);
$criteria->add(QubitTerm::TAXONOMY_ID, $this->resource->taxonomyId);
$criteria->addJoin(QubitTerm::ID, QubitTermI18n::ID);
$criteria->add(QubitTermI18n::CULTURE, $this->context->user->getCulture());
$criteria->add(QubitTermI18n::NAME, $value);
if (0 < intval(BasePeer::doCount($criteria)->fetchColumn(0))) {
throw new sfValidatorError($validator, $this->context->i18n->__('Name - A term with this name already exists.'));
}
}
示例4: execute
public function execute($request)
{
if (!isset($request->limit)) {
$request->limit = sfConfig::get('app_hits_per_page');
}
$this->resource = $this->getRoute()->resource;
$criteria = new Criteria();
$criteria->add(QubitRelation::SUBJECT_ID, $this->resource->id);
$criteria->add(QubitRelation::TYPE_ID, QubitTerm::HAS_PHYSICAL_OBJECT_ID);
$criteria->addJoin(QubitRelation::OBJECT_ID, QubitInformationObject::ID);
$this->informationObjects = QubitInformationObject::get($criteria);
$c2 = clone $criteria;
$this->foundcount = BasePeer::doCount($c2)->fetchColumn(0);
}
示例5: testDoCountDuplicateColumnName
public function testDoCountDuplicateColumnName()
{
$con = Propel::getConnection();
$c = new Criteria();
$c->addSelectColumn(BookPeer::ID);
$c->addJoin(BookPeer::AUTHOR_ID, AuthorPeer::ID);
$c->addSelectColumn(AuthorPeer::ID);
$c->setLimit(3);
try {
$count = BasePeer::doCount($c, $con);
} catch (Exception $e) {
$this->fail('doCount() cannot deal with a criteria selecting duplicate column names ');
}
}
示例6: execute
public function execute($request)
{
$this->resource = $this->getRoute()->resource;
if (!isset($this->resource)) {
$this->forward404();
}
if (!$this->getUser()->isAuthenticated()) {
QubitAcl::forwardUnauthorized();
}
$criteria = new Criteria();
$criteria->setDistinct();
$criteria->add(QubitInformationObject::LFT, $this->resource->lft, Criteria::GREATER_EQUAL);
$criteria->add(QubitInformationObject::RGT, $this->resource->rgt, Criteria::LESS_EQUAL);
$criteria->add(QubitRelation::TYPE_ID, QubitTerm::HAS_PHYSICAL_OBJECT_ID);
$criteria->addJoin(QubitRelation::OBJECT_ID, QubitInformationObject::ID);
$criteria->addJoin(QubitRelation::SUBJECT_ID, QubitPhysicalObject::ID);
$this->physicalObjects = QubitPhysicalObject::get($criteria);
if (0 == count($this->physicalObjects)) {
return sfView::ERROR;
}
$c2 = clone $criteria;
$this->foundcount = BasePeer::doCount($c2)->fetchColumn(0);
}
示例7: execute
public function execute($request)
{
$this->thumbnails = array();
// Set limit (null for no limit)
if (!isset($request->showFullImageflow) || 'true' != $request->showFullImageflow) {
$this->limit = sfConfig::get('app_hits_per_page', 10);
}
// Add thumbs
$criteria = new Criteria();
$criteria->addJoin(QubitInformationObject::ID, QubitDigitalObject::INFORMATION_OBJECT_ID);
$criteria->add(QubitInformationObject::LFT, $this->resource->lft, Criteria::GREATER_THAN);
$criteria->add(QubitInformationObject::RGT, $this->resource->rgt, Criteria::LESS_THAN);
if (isset($this->limit)) {
$criteria->setLimit($this->limit);
}
foreach (QubitDigitalObject::get($criteria) as $item) {
$thumbnail = $item->getRepresentationByUsage(QubitTerm::THUMBNAIL_ID);
if (!$thumbnail) {
$thumbnail = QubitDigitalObject::getGenericRepresentation($item->mimeType, QubitTerm::THUMBNAIL_ID);
$thumbnail->setParent($item);
}
$this->thumbnails[] = $thumbnail;
}
// Get total number of descendant digital objects
$this->total = 0;
if (isset($this->resource)) {
$criteria = new Criteria();
$criteria->addJoin(QubitInformationObject::ID, QubitDigitalObject::INFORMATION_OBJECT_ID);
$criteria->add(QubitInformationObject::LFT, $this->resource->lft, Criteria::GREATER_THAN);
$criteria->add(QubitInformationObject::RGT, $this->resource->rgt, Criteria::LESS_THAN);
$this->total = BasePeer::doCount($criteria)->fetchColumn(0);
}
if (2 > count($this->thumbnails)) {
return sfView::NONE;
}
}
示例8: doCount
public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
{
// we may modify criteria, so copy it first
$criteria = clone $criteria;
// We need to set the primary table name, since in the case that there are no WHERE columns
// it will be impossible for the BasePeer::createSelectSql() method to determine which
// tables go into the FROM clause.
$criteria->setPrimaryTableName(FormularioPeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
FormularioPeer::addSelectColumns($criteria);
}
$criteria->clearOrderByColumns();
// ORDER BY won't ever affect the count
$criteria->setDbName(self::DATABASE_NAME);
// Set the correct dbName
if ($con === null) {
$con = Propel::getConnection(FormularioPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
foreach (sfMixer::getCallables('BaseFormularioPeer:doCount:doCount') as $callable) {
call_user_func($callable, 'BaseFormularioPeer', $criteria, $con);
}
$criteria = self::kriterio($criteria);
// BasePeer returns a PDOStatement
$stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$count = (int) $row[0];
} else {
$count = 0;
// no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
示例9: doCountJoinAllExceptTipolocacion
public static function doCountJoinAllExceptTipolocacion(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
$criteria = clone $criteria;
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
LocacionPeer::addSelectColumns($criteria);
}
$criteria->clearOrderByColumns();
$criteria->setDbName(self::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(LocacionPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria->addJoin(array(LocacionPeer::FK_PROVINCIA_ID), array(ProvinciaPeer::ID), $join_behavior);
$stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$count = (int) $row[0];
} else {
$count = 0;
}
$stmt->closeCursor();
return $count;
}
示例10: doCountJoinAllExceptAbsenceEleveLieu
/**
* Returns the number of rows matching criteria, joining the related AbsenceEleveLieu table
*
* @param Criteria $criteria
* @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
* @param PropelPDO $con
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
* @return int Number of matching rows.
*/
public static function doCountJoinAllExceptAbsenceEleveLieu(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
// we're going to modify criteria, so copy it first
$criteria = clone $criteria;
// We need to set the primary table name, since in the case that there are no WHERE columns
// it will be impossible for the BasePeer::createSelectSql() method to determine which
// tables go into the FROM clause.
$criteria->setPrimaryTableName(AbsenceEleveSaisiePeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
AbsenceEleveSaisiePeer::addSelectColumns($criteria);
}
$criteria->clearOrderByColumns(); // ORDER BY should not affect count
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(AbsenceEleveSaisiePeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria->addJoin(AbsenceEleveSaisiePeer::UTILISATEUR_ID, UtilisateurProfessionnelPeer::LOGIN, $join_behavior);
$criteria->addJoin(AbsenceEleveSaisiePeer::ELEVE_ID, ElevePeer::ID_ELEVE, $join_behavior);
$criteria->addJoin(AbsenceEleveSaisiePeer::ID_EDT_CRENEAU, EdtCreneauPeer::ID_DEFINIE_PERIODE, $join_behavior);
$criteria->addJoin(AbsenceEleveSaisiePeer::ID_EDT_EMPLACEMENT_COURS, EdtEmplacementCoursPeer::ID_COURS, $join_behavior);
$criteria->addJoin(AbsenceEleveSaisiePeer::ID_GROUPE, GroupePeer::ID, $join_behavior);
$criteria->addJoin(AbsenceEleveSaisiePeer::ID_CLASSE, ClassePeer::ID, $join_behavior);
$criteria->addJoin(AbsenceEleveSaisiePeer::ID_AID, AidDetailsPeer::ID, $join_behavior);
// soft_delete behavior
if (AbsenceEleveSaisieQuery::isSoftDeleteEnabled()) {
$criteria->add(AbsenceEleveSaisiePeer::DELETED_AT, null, Criteria::ISNULL);
} else {
AbsenceEleveSaisiePeer::enableSoftDelete();
}
$stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$count = (int) $row[0];
} else {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
示例11: doCountJoinAllExceptPeriodo
public static function doCountJoinAllExceptPeriodo(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
$criteria = clone $criteria;
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
ExamenPeer::addSelectColumns($criteria);
}
$criteria->clearOrderByColumns();
$criteria->setDbName(self::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(ExamenPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria->addJoin(array(ExamenPeer::FK_ESCALANOTA_ID), array(EscalanotaPeer::ID), $join_behavior);
$criteria->addJoin(array(ExamenPeer::FK_ALUMNO_ID), array(AlumnoPeer::ID), $join_behavior);
$criteria->addJoin(array(ExamenPeer::FK_ACTIVIDAD_ID), array(ActividadPeer::ID), $join_behavior);
$stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$count = (int) $row[0];
} else {
$count = 0;
}
$stmt->closeCursor();
return $count;
}
示例12: doCountJoinAll
public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
$criteria = clone $criteria;
$criteria->setPrimaryTableName(ActividadPeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
ActividadPeer::addSelectColumns($criteria);
}
$criteria->clearOrderByColumns();
$criteria->setDbName(self::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(ActividadPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria->addJoin(array(ActividadPeer::FK_ESTABLECIMIENTO_ID), array(EstablecimientoPeer::ID), $join_behavior);
$stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$count = (int) $row[0];
} else {
$count = 0;
}
$stmt->closeCursor();
return $count;
}
示例13: doCountJoinAllExceptReservationRelatedByReservationparentId
/**
* Returns the number of rows matching criteria, joining the related ReservationRelatedByReservationparentId table
*
* @param Criteria $c
* @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
* @param PropelPDO $con
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
* @return int Number of matching rows.
*/
public static function doCountJoinAllExceptReservationRelatedByReservationparentId(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
// we're going to modify criteria, so copy it first
$criteria = clone $criteria;
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
ReservationPeer::addSelectColumns($criteria);
}
$criteria->clearOrderByColumns();
// ORDER BY won't ever affect the count
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(ReservationPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria->addJoin(array(ReservationPeer::ROOMPROFILE_ID), array(RoomprofilePeer::ID), $join_behavior);
$criteria->addJoin(array(ReservationPeer::ACTIVITY_ID), array(ActivityPeer::ID), $join_behavior);
$criteria->addJoin(array(ReservationPeer::RESERVATIONREASON_ID), array(ReservationreasonPeer::ID), $join_behavior);
$criteria->addJoin(array(ReservationPeer::USERGROUP_ID), array(UsergroupPeer::ID), $join_behavior);
$criteria->addJoin(array(ReservationPeer::CARD_ID), array(CardPeer::ID), $join_behavior);
$criteria->addJoin(array(ReservationPeer::USER_ID), array(UserPeer::ID), $join_behavior);
foreach (sfMixer::getCallables('BaseReservationPeer:doCount:doCount') as $callable) {
call_user_func($callable, 'BaseReservationPeer', $criteria, $con);
}
$stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$count = (int) $row[0];
} else {
$count = 0;
// no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
示例14: doCountJoinAllExceptMemberRelatedByMasterMemberId
/**
* Returns the number of rows matching criteria, joining the related MemberRelatedByMasterMemberId table
*
* @param Criteria $c
* @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
* @param PropelPDO $con
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
* @return int Number of matching rows.
*/
public static function doCountJoinAllExceptMemberRelatedByMasterMemberId(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
// we're going to modify criteria, so copy it first
$criteria = clone $criteria;
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
MemberPeer::addSelectColumns($criteria);
}
$criteria->clearOrderByColumns();
// ORDER BY won't ever affect the count
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(MemberPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria->addJoin(array(MemberPeer::PERSON_ID), array(PersonPeer::ID), $join_behavior);
$criteria->addJoin(array(MemberPeer::WING_ID), array(WingPeer::ID), $join_behavior);
$criteria->addJoin(array(MemberPeer::MEMBER_CLASS_ID), array(MemberClassPeer::ID), $join_behavior);
foreach (sfMixer::getCallables('BaseMemberPeer:doCount:doCount') as $callable) {
call_user_func($callable, 'BaseMemberPeer', $criteria, $con);
}
$stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$count = (int) $row[0];
} else {
$count = 0;
// no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
示例15: doCountJoinAllExceptModifieParUtilisateur
/**
* Returns the number of rows matching criteria, joining the related ModifieParUtilisateur table
*
* @param Criteria $criteria
* @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
* @param PropelPDO $con
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
* @return int Number of matching rows.
*/
public static function doCountJoinAllExceptModifieParUtilisateur(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
// we're going to modify criteria, so copy it first
$criteria = clone $criteria;
// We need to set the primary table name, since in the case that there are no WHERE columns
// it will be impossible for the BasePeer::createSelectSql() method to determine which
// tables go into the FROM clause.
$criteria->setPrimaryTableName(AbsenceEleveTraitementPeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
AbsenceEleveTraitementPeer::addSelectColumns($criteria);
}
$criteria->clearOrderByColumns(); // ORDER BY should not affect count
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(AbsenceEleveTraitementPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria->addJoin(AbsenceEleveTraitementPeer::A_TYPE_ID, AbsenceEleveTypePeer::ID, $join_behavior);
$criteria->addJoin(AbsenceEleveTraitementPeer::A_MOTIF_ID, AbsenceEleveMotifPeer::ID, $join_behavior);
$criteria->addJoin(AbsenceEleveTraitementPeer::A_JUSTIFICATION_ID, AbsenceEleveJustificationPeer::ID, $join_behavior);
// soft_delete behavior
if (AbsenceEleveTraitementQuery::isSoftDeleteEnabled()) {
$criteria->add(AbsenceEleveTraitementPeer::DELETED_AT, null, Criteria::ISNULL);
} else {
AbsenceEleveTraitementPeer::enableSoftDelete();
}
$stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$count = (int) $row[0];
} else {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}