本文整理汇总了PHP中ArticlePeer类的典型用法代码示例。如果您正苦于以下问题:PHP ArticlePeer类的具体用法?PHP ArticlePeer怎么用?PHP ArticlePeer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ArticlePeer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: executeEdit
public function executeEdit($request)
{
$this->form = new ArticleForm(ArticlePeer::doSelectOne(new Criteria()));
if ($request->isMethod(sfRequest::POST)) {
$this->form->bind($request->getParameter('article'));
if ($this->form->isValid()) {
$this->form->save();
$this->redirect('unique/edit');
}
}
}
开发者ID:laiello,项目名称:tesiscdfeg12,代码行数:11,代码来源:actions.class.php
示例2: executeShowArchive
public function executeShowArchive(sfWebRequest $request)
{
$c = new Criteria();
$year = $request->getParameter('year');
$month = $request->getParameter('month');
$nextMonth = mktime(0, 0, 0, $month + 1, 0, $year);
$thisMonth = mktime(0, 0, 0, $month, 0, $year);
$c->add(ArticlePeer::CREATED_AT, $nextMonth, Criteria::LESS_THAN);
$c->addAnd(ArticlePeer::CREATED_AT, $thisMonth, Criteria::GREATER_THAN);
// $c->addAnd(ArticlePeer::CREATED_AT,$thisMonth,'GREATERTHAN');
$this->posts = ArticlePeer::doSelect($c);
}
开发者ID:rfeizi,项目名称:sample-codes,代码行数:12,代码来源:actions.class.php
示例3: getArticle
public function getArticle(PropelPDO $con = null)
{
if ($this->aArticle === null && $this->article_id !== null) {
$c = new Criteria(ArticlePeer::DATABASE_NAME);
$c->add(ArticlePeer::ID, $this->article_id);
$this->aArticle = ArticlePeer::doSelectOne($c, $con);
}
return $this->aArticle;
}
开发者ID:yasirgit,项目名称:afids,代码行数:9,代码来源:BaseAttachment.php
示例4: getArticle
public function getArticle($con = null)
{
include_once 'lib/model/om/BaseArticlePeer.php';
if ($this->aArticle === null && $this->article_id !== null) {
$this->aArticle = ArticlePeer::retrieveByPK($this->article_id, $con);
}
return $this->aArticle;
}
开发者ID:valerio-bozzolan,项目名称:openparlamento,代码行数:8,代码来源:BaseAuthorArticle.php
示例5: fromArray
/**
* Populates the object using an array.
*
* This is particularly useful when populating an object from one of the
* request arrays (e.g. $_POST). This method goes through the column
* names, checking to see whether a matching key exists in populated
* array. If so the setByName() method is called for that column.
*
* You can specify the key type of the array by additionally passing one
* of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
* The default key type is the column's phpname (e.g. 'AuthorId')
*
* @param array $arr An array to populate the object from.
* @param string $keyType The type of keys the array uses.
* @return void
*/
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
{
$keys = ArticlePeer::getFieldNames($keyType);
if (array_key_exists($keys[0], $arr)) {
$this->setId($arr[$keys[0]]);
}
if (array_key_exists($keys[1], $arr)) {
$this->setTitle($arr[$keys[1]]);
}
if (array_key_exists($keys[2], $arr)) {
$this->setContent($arr[$keys[2]]);
}
}
开发者ID:nvieirafelipe,项目名称:graviola-project,代码行数:30,代码来源:BaseArticle.php
示例6: getArticle
public function getArticle($con = null)
{
if ($this->aArticle === null && $this->article_id !== null) {
$this->aArticle = ArticlePeer::retrieveByPK($this->article_id, $con);
}
return $this->aArticle;
}
开发者ID:ajith24,项目名称:ajithworld,代码行数:7,代码来源:BaseAuthorArticle.php
示例7: fromArray
/**
* Populates the object using an array.
*
* This is particularly useful when populating an object from one of the
* request arrays (e.g. $_POST). This method goes through the column
* names, checking to see whether a matching key exists in populated
* array. If so the setByName() method is called for that column.
*
* You can specify the key type of the array by additionally passing one
* of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
* The default key type is the column's phpname (e.g. 'AuthorId')
*
* @param array $arr An array to populate the object from.
* @param string $keyType The type of keys the array uses.
* @return void
*/
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
{
$keys = ArticlePeer::getFieldNames($keyType);
if (array_key_exists($keys[0], $arr)) {
$this->setId($arr[$keys[0]]);
}
if (array_key_exists($keys[1], $arr)) {
$this->setTitle($arr[$keys[1]]);
}
if (array_key_exists($keys[2], $arr)) {
$this->setBody($arr[$keys[2]]);
}
if (array_key_exists($keys[3], $arr)) {
$this->setOnline($arr[$keys[3]]);
}
if (array_key_exists($keys[4], $arr)) {
$this->setExcerpt($arr[$keys[4]]);
}
if (array_key_exists($keys[5], $arr)) {
$this->setCategoryId($arr[$keys[5]]);
}
if (array_key_exists($keys[6], $arr)) {
$this->setCreatedAt($arr[$keys[6]]);
}
if (array_key_exists($keys[7], $arr)) {
$this->setEndDate($arr[$keys[7]]);
}
if (array_key_exists($keys[8], $arr)) {
$this->setBookId($arr[$keys[8]]);
}
}
开发者ID:omarcl,项目名称:training-spot,代码行数:48,代码来源:BaseArticle.php
示例8: doSelectJoinAllExceptAuthor
/**
* Selects a collection of AuthorArticle objects pre-filled with all related objects except Author.
*
* @param Criteria $criteria
* @param PropelPDO $con
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
* @return array Array of AuthorArticle objects.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectJoinAllExceptAuthor(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
$criteria = clone $criteria;
// Set the correct dbName if it has not been overridden
// $criteria->getDbName() will return the same object if not set to another value
// so == check is okay and faster
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(self::DATABASE_NAME);
}
AuthorArticlePeer::addSelectColumns($criteria);
$startcol2 = AuthorArticlePeer::NUM_COLUMNS - AuthorArticlePeer::NUM_LAZY_LOAD_COLUMNS;
ArticlePeer::addSelectColumns($criteria);
$startcol3 = $startcol2 + (ArticlePeer::NUM_COLUMNS - ArticlePeer::NUM_LAZY_LOAD_COLUMNS);
$criteria->addJoin(AuthorArticlePeer::ARTICLE_ID, ArticlePeer::ID, $join_behavior);
// symfony_behaviors behavior
foreach (sfMixer::getCallables(self::getMixerPreSelectHook(__FUNCTION__)) as $sf_hook) {
call_user_func($sf_hook, 'BaseAuthorArticlePeer', $criteria, $con);
}
$stmt = BasePeer::doSelect($criteria, $con);
$results = array();
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key1 = AuthorArticlePeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj1 = AuthorArticlePeer::getInstanceFromPool($key1))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://propel.phpdb.org/trac/ticket/509
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$cls = AuthorArticlePeer::getOMClass(false);
$obj1 = new $cls();
$obj1->hydrate($row);
AuthorArticlePeer::addInstanceToPool($obj1, $key1);
}
// if obj1 already loaded
// Add objects for joined Article rows
$key2 = ArticlePeer::getPrimaryKeyHashFromRow($row, $startcol2);
if ($key2 !== null) {
$obj2 = ArticlePeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = ArticlePeer::getOMClass(false);
$obj2 = new $cls();
$obj2->hydrate($row, $startcol2);
ArticlePeer::addInstanceToPool($obj2, $key2);
}
// if $obj2 already loaded
// Add the $obj1 (AuthorArticle) to the collection in $obj2 (Article)
$obj2->addAuthorArticle($obj1);
}
// if joined row is not null
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
开发者ID:BGCX067,项目名称:fakeq-svn-to-git,代码行数:63,代码来源:BaseAuthorArticlePeer.php
示例9: addSortCriteria
protected function addSortCriteria($c)
{
if ($sort_column = $this->getUser()->getAttribute('sort', null, 'sf_admin/article/sort')) {
$sort_column = sfInflector::camelize(strtolower($sort_column));
$sort_column = ArticlePeer::translateFieldName($sort_column, BasePeer::TYPE_PHPNAME, BasePeer::TYPE_COLNAME);
if ($this->getUser()->getAttribute('type', null, 'sf_admin/article/sort') == 'asc') {
$c->addAscendingOrderByColumn($sort_column);
} else {
$c->addDescendingOrderByColumn($sort_column);
}
}
}
开发者ID:ajith24,项目名称:ajithworld,代码行数:12,代码来源:actions.class.php
示例10: executeGetFixtureModel
/**
* @WSMethod(name='getFixtureModel')
*
* @return Article[] All articles loaded from the database.
*/
public function executeGetFixtureModel(sfWebRequest $request)
{
$this->result = ArticlePeer::doSelect(new Criteria());
return sfView::SUCCESS;
}
开发者ID:nvieirafelipe,项目名称:graviola-project,代码行数:10,代码来源:actions.class.php
示例11: addSortCriteria
protected function addSortCriteria($criteria)
{
if (array(null, null) == ($sort = $this->getSort())) {
return;
}
$column = ArticlePeer::translateFieldName($sort[0], BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_COLNAME);
if ('asc' == $sort[1]) {
$criteria->addAscendingOrderByColumn($column);
} else {
$criteria->addDescendingOrderByColumn($column);
}
}
开发者ID:rfeizi,项目名称:sample-codes,代码行数:12,代码来源:actions.class.php
示例12: executeArchiveList
public function executeArchiveList()
{
$c = new Criteria();
$c->addDescendingOrderByColumn('created_at');
$this->posts = ArticlePeer::doSelect($c);
}
开发者ID:rfeizi,项目名称:sample-codes,代码行数:6,代码来源:components.class.php
示例13: executeShoppingCart2
public function executeShoppingCart2(sfWebRequest $request)
{
$this->categories = CategoryPeer::getActiveCategories();
$this->paths = array();
$promoter = $promoter = PromoterPeer::getPromoterByUserId($this->getUser()->getId());
$this->state = $promoter->getIdState();
$this->articles = ArticlePeer::doSelect(new Criteria());
if ($request->isMethod('post')) {
$cart = $this->createCartIfNotExists();
foreach ($this->articles as $key => $article) {
$value = $request->getParameter($article->getId());
if ($value > 0) {
$this->createCartArticle($cart, $article, $value);
}
}
}
$cart = CartPeer::getCart($promoter->getClientId());
if (!isset($cart)) {
$cart = new Cart();
}
$this->cart_articles = $cart->getCartArticles();
//sacar articulos mayor a 1 mes en el carrito
foreach ($this->cart_articles as $cart_article) {
$fecha = $this->dateadd($cart_article->getUpdatedAt(), 0, 1, 0, 0, 0, 0);
$date1 = new DateTime("now");
$date2 = new DateTime($fecha);
if ($date1 > $date2) {
$cart_article->delete();
$cart_article->save();
}
}
$this->total = 0;
foreach ($this->cart_articles as $cart_article) {
$this->total += $cart_article->getPrice() * $cart_article->getQuantity();
}
}
开发者ID:robertsergio,项目名称:sophiaStore-module,代码行数:36,代码来源:actions.class.php
示例14: getArticle
static function getArticle($id)
{
$c = new Criteria();
$c->add(ArticlePeer::ID, $id);
return ArticlePeer::doSelectOne($c);
}
开发者ID:rfeizi,项目名称:sample-codes,代码行数:6,代码来源:ArticlePeer.php
示例15: getArticlesJoinBook
public function getArticlesJoinBook($criteria = null, $con = null)
{
include_once 'lib/model/om/BaseArticlePeer.php';
if ($criteria === null) {
$criteria = new Criteria();
} elseif ($criteria instanceof Criteria) {
$criteria = clone $criteria;
}
if ($this->collArticles === null) {
if ($this->isNew()) {
$this->collArticles = array();
} else {
$criteria->add(ArticlePeer::CATEGORY_ID, $this->getId());
$this->collArticles = ArticlePeer::doSelectJoinBook($criteria, $con);
}
} else {
$criteria->add(ArticlePeer::CATEGORY_ID, $this->getId());
if (!isset($this->lastArticleCriteria) || !$this->lastArticleCriteria->equals($criteria)) {
$this->collArticles = ArticlePeer::doSelectJoinBook($criteria, $con);
}
}
$this->lastArticleCriteria = $criteria;
return $this->collArticles;
}
开发者ID:valerio-bozzolan,项目名称:openparlamento,代码行数:24,代码来源:BaseCategory.php
示例16: retrieveByPKs
/**
* Retrieve multiple objects by pkey.
*
* @param array $pks List of primary keys
* @param PropelPDO $con the connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function retrieveByPKs($pks, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(ArticlePeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$objs = null;
if (empty($pks)) {
$objs = array();
} else {
$criteria = new Criteria(ArticlePeer::DATABASE_NAME);
$criteria->add(ArticlePeer::ID, $pks, Criteria::IN);
$objs = ArticlePeer::doSelect($criteria, $con);
}
return $objs;
}
开发者ID:redandpink,项目名称:h-emergenze,代码行数:23,代码来源:BaseArticlePeer.php
示例17: getArticlesJoinBook
public function getArticlesJoinBook($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
if ($criteria === null) {
$criteria = new Criteria(CategoryPeer::DATABASE_NAME);
} elseif ($criteria instanceof Criteria) {
$criteria = clone $criteria;
}
if ($this->collArticles === null) {
if ($this->isNew()) {
$this->collArticles = array();
} else {
$criteria->add(ArticlePeer::CATEGORY_ID, $this->id);
$this->collArticles = ArticlePeer::doSelectJoinBook($criteria, $con, $join_behavior);
}
} else {
$criteria->add(ArticlePeer::CATEGORY_ID, $this->id);
if (!isset($this->lastArticleCriteria) || !$this->lastArticleCriteria->equals($criteria)) {
$this->collArticles = ArticlePeer::doSelectJoinBook($criteria, $con, $join_behavior);
}
}
$this->lastArticleCriteria = $criteria;
return $this->collArticles;
}
开发者ID:JimmyVB,项目名称:Symfony-v1.2,代码行数:23,代码来源:BaseCategory.php
示例18: getArticlesJoinCategory
/**
* If this collection has already been initialized with
* an identical criteria, it returns the collection.
* Otherwise if this Book is new, it will return
* an empty collection; or if this Book has previously
* been saved, it will retrieve related Articles from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
* actually need in Book.
*/
public function getArticlesJoinCategory($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
if ($criteria === null) {
$criteria = new Criteria(BookPeer::DATABASE_NAME);
} elseif ($criteria instanceof Criteria) {
$criteria = clone $criteria;
}
if ($this->collArticles === null) {
if ($this->isNew()) {
$this->collArticles = array();
} else {
$criteria->add(ArticlePeer::BOOK_ID, $this->id);
$this->collArticles = ArticlePeer::doSelectJoinCategory($criteria, $con, $join_behavior);
}
} else {
// the following code is to determine if a new query is
// called for. If the criteria is the same as the last
// one, just return the collection.
$criteria->add(ArticlePeer::BOOK_ID, $this->id);
if (!isset($this->lastArticleCriteria) || !$this->lastArticleCriteria->equals($criteria)) {
$this->collArticles = ArticlePeer::doSelectJoinCategory($criteria, $con, $join_behavior);
}
}
$this->lastArticleCriteria = $criteria;
return $this->collArticles;
}
开发者ID:snoopckuu,项目名称:prmanagment,代码行数:37,代码来源:BaseBook.php
示例19: doSelectJoinAllExceptAuthor
public static function doSelectJoinAllExceptAuthor(Criteria $c, $con = null)
{
$c = clone $c;
if ($c->getDbName() == Propel::getDefaultDB()) {
$c->setDbName(self::DATABASE_NAME);
}
AuthorArticlePeer::addSelectColumns($c);
$startcol2 = AuthorArticlePeer::NUM_COLUMNS - AuthorArticlePeer::NUM_LAZY_LOAD_COLUMNS + 1;
ArticlePeer::addSelectColumns($c);
$startcol3 = $startcol2 + ArticlePeer::NUM_COLUMNS;
$c->addJoin(AuthorArticlePeer::ARTICLE_ID, ArticlePeer::ID);
$rs = BasePeer::doSelect($c, $con);
$results = array();
while ($rs->next()) {
$omClass = AuthorArticlePeer::getOMClass();
$cls = Propel::import($omClass);
$obj1 = new $cls();
$obj1->hydrate($rs);
$omClass = ArticlePeer::getOMClass();
$cls = Propel::import($omClass);
$obj2 = new $cls();
$obj2->hydrate($rs, $startcol2);
$newObject = true;
for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
$temp_obj1 = $results[$j];
$temp_obj2 = $temp_obj1->getArticle();
if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
$newObject = false;
$temp_obj2->addAuthorArticle($obj1);
break;
}
}
if ($newObject) {
$obj2->initAuthorArticles();
$obj2->addAuthorArticle($obj1);
}
$results[] = $obj1;
}
return $results;
}
开发者ID:ajith24,项目名称:ajithworld,代码行数:40,代码来源:BaseAuthorArticlePeer.php
示例20: sleep
$finder->where('Title', 'bar')->findOne(); // write cache 2
$SQL1 = $finder->getLatestQuery();
$finder->where('Title', 'foo')->findOne(); // read cache 1
$SQL2 = $finder->getLatestQuery();
$t->is($SQL1, $SQL2, 'The same query asked within the lifetime uses the cache');
sleep(2);
$finder->where('Title', 'foo')->findOne(); // re-write cache 1
$SQL3 = $finder->getLatestQuery();
$t->isnt($SQL1, $SQL3, 'The same query asked after the lifetime does not use the cache');
*/
$t->diag('Cached results');
$cache->clear();
ArticlePeer::doDeleteAll();
$article1 = new Article();
$article1->setTitle('foo1');
$article1->save();
$article2 = new Article();
$article2->setTitle('foo2');
$article2->save();
$finder = DbFinder::from('Article')->useCache($cache, 10);
$finder->where('Title', 'foo1')->findOne(); // normal query
$article = $finder->where('Title', 'foo1')->findOne(); // cached query
$t->isa_ok($article, 'Article', 'Cached finder queries return Model objects');
$t->is($article->getId(), $article1->getId(), 'find() finder queries can be cached');
$finder->where('Title', 'foo1')->count(); // normal query
$nb = $finder->where('Title', 'foo1')->count(); // cached query
$t->is($nb, 1, 'count() finder queries can be cached');
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:31,代码来源:sfPropelFinderCacheTest.php
注:本文中的ArticlePeer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论