Changeset 10666
- Timestamp:
- 08/05/08 16:54:22 (4 months ago)
- Files:
-
- plugins/sfPropelFinderPlugin/README (modified) (1 diff)
- plugins/sfPropelFinderPlugin/lib/DbFinder.php (modified) (1 diff)
- plugins/sfPropelFinderPlugin/lib/sfDoctrineFinder.php (modified) (31 diffs)
- plugins/sfPropelFinderPlugin/lib/sfPropelFinder.php (modified) (29 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/sfPropelFinderPlugin/README
r10664 r10666 614 614 === 2008-08-05 | Trunk === 615 615 616 * francois: Added more phpdoc to `sfPropelFinder` and `sfDoctrineFinder` 616 617 * mrhyde: Fixed issue when calling several termination methods on a finder 617 618 * francois: Implemented `sfDoctrineFinder::count()` plugins/sfPropelFinderPlugin/lib/DbFinder.php
r10655 r10666 238 238 abstract public function set($values, $forceIndividualSaves = false); 239 239 240 // Hydrating 241 242 abstract public function with($classes); 243 abstract public function withI18n($culture = null); 244 abstract public function withColumn($column, $alias = null, $type = null); 245 246 // Finder Filters 247 248 abstract public function distinct(); 249 abstract public function where(); 250 abstract public function _and(); 251 abstract public function _or(); 252 abstract public function combine($conditions, $operator = 'and', $namedCondition = null); 253 abstract public function relatedTo($object); 254 abstract public function orderBy($columnName, $order = null); 255 abstract public function groupBy($columnName); 256 abstract public function groupByClass($class); 257 abstract public function guessOrder($direction = 'desc'); 258 abstract public function join(); 259 240 260 // Finder utilities 241 261 262 abstract public function keepQuery($keep = true); 242 263 abstract public function getLatestQuery(); 243 264 abstract protected function cleanup(); plugins/sfPropelFinderPlugin/lib/sfDoctrineFinder.php
r10655 r10666 123 123 // Finder Executers 124 124 125 /** 126 * Returns the number of records matching the finder 127 * 128 * @param Boolean $distinct Whether the count query has to add a DISTINCT keyword (unsupported) 129 * 130 * @return integer Number of records matching the finder 131 */ 125 132 public function count($distinct = false) 126 133 { … … 131 138 } 132 139 140 /** 141 * Executes the finder and returns the matching Doctrine objects 142 * 143 * @param integer $limit Optional maximum number of results to retrieve 144 * 145 * @return array A list of Doctrine_Record objects 146 */ 133 147 public function find($limit = null) 134 148 { … … 143 157 } 144 158 159 /** 160 * Limits the search to a single result, and executes the finder 161 * Returns the first Doctrine_Record object matching the finder 162 * 163 * @return mixed a Doctrine_Record object or null 164 */ 145 165 public function findOne() 146 166 { … … 150 170 } 151 171 152 public function findLast($column = null) 153 { 154 if($column) 155 { 156 $this->orderBy($column, 'desc'); 172 /** 173 * Returns the last record matching the finder 174 * Optionally, you can specify the column to sort on 175 * If no column is passed, the finder guesses the column to use 176 * @see guessOrder() 177 * 178 * @param string $columnName Optional: The column to order by 179 * 180 * @return mixed a Doctrine_Record object or null 181 */ 182 public function findLast($columnName = null) 183 { 184 if($columnName) 185 { 186 $this->orderBy($columnName, 'desc'); 157 187 } 158 188 else … … 164 194 } 165 195 166 public function findFirst($column = null) 167 { 168 if($column) 169 { 170 $this->orderBy($column, 'asc'); 196 /** 197 * Returns the first record matching the finder 198 * Optionally, you can specify the column to sort on 199 * If no column is passed, the finder guesses the column to use 200 * @see guessOrder() 201 * 202 * @param string $columnName Optional: The column to order by 203 * 204 * @return mixed a Doctrine_Record object or null 205 */ 206 public function findFirst($columnName = null) 207 { 208 if($columnName) 209 { 210 $this->orderBy($columnName, 'asc'); 171 211 } 172 212 else … … 178 218 } 179 219 220 /** 221 * Adds a condition on a column and returns the records matching the finder 222 * 223 * @param string $columnName Name of the columns 224 * @param mixed $value 225 * @param integer $limit Optional maximum number of records to return 226 * 227 * @return array A list of Doctrine_Record Propel objects 228 */ 180 229 public function findBy($columnName, $value, $limit = null) 181 230 { … … 186 235 } 187 236 237 /** 238 * Adds a condition on a column and returns the first record matching the finder 239 * Useful to retrieve objects by a column which is not the primary key 240 * 241 * @param string $columnName Name of the columns 242 * @param mixed $value 243 * 244 * @return mixed a Doctrine_Record object or null 245 */ 188 246 public function findOneBy($columnName, $value) 189 247 { … … 194 252 } 195 253 254 /** 255 * Finds record(s) based on one or several primary keys 256 * Takes into account hydrating methods previously called on the finder 257 * 258 * @param mixed $pk A primary kay, a composite primary key, or an array of primary keys 259 * 260 * @return mixed One or several Doctrine_Record records (based on the input) 261 */ 196 262 public function findPk($pk) 197 263 { … … 232 298 } 233 299 300 /** 301 * Deletes the records found by the finder 302 * Beware that behaviors based on hooks in the object's delete() method 303 * Will only be triggered if you force individual deletes, i.e. if you pass true as first argument 304 * 305 * @param Boolean $forceIndividualDeletes 306 * 307 * @return Integer Number of deleted rows 308 */ 234 309 public function delete($forceIndividualDeletes = false) 235 310 { … … 238 313 } 239 314 315 /** 316 * Prepares a pager based on the finder 317 * The pager is initialized (it knows how many pages it contains) 318 * But it won't be populated until you call getResults() on it 319 * 320 * @param integer $page The current page (1 by default) 321 * @param integer $maxPerPage The maximum number of results per page (10 by default) 322 * 323 * @return sfDoctrineFinderPager The initialized pager object 324 */ 240 325 public function paginate($page = 1, $maxPerPage = 10) 241 326 { … … 243 328 } 244 329 330 /** 331 * Updates the records found by the finder 332 * Beware that behaviors based on hooks in the object's save() method 333 * Will only be triggered if you force individual saves, i.e. if you pass true as second argument 334 * 335 * @param Array $values Associative array of keys and values to replace 336 * @param Boolean $forceIndividualSaves 337 * 338 * @return Integer Number of deleted rows 339 */ 245 340 public function set($values, $forceIndividualSaves = false) 246 341 { … … 249 344 } 250 345 346 /** 347 * Cleans up the query object (if necessary) 348 * 349 * @return sfDoctrineFinder the current finder object 350 */ 251 351 protected function cleanup() 252 352 { … … 259 359 } 260 360 261 361 /** 362 * Finalizes the query, executes it and hydrates results 363 * 364 * @return array List of Doctrine_Record objects 365 */ 262 366 public function doFind() 263 367 { … … 277 381 // Hydrating 278 382 383 /** 384 * Ask the finder to hydrate related records 385 * Equivalent to Doctrine's JOIN DQL 386 * Examples: 387 * // Article has an author, article has a category, and author has a group 388 * $articleFinder->with('Author')->find(); 389 * $articleFinder->with('Author', 'Category')->find(); 390 * $articleFinder->with('Author', 'Group')->find(); 391 * $articleFinder->join('Author')->with('Group')->find(); 392 * // By default, the finder uses a simple join (where) but you can force another join 393 * $articleFinder->leftJoin('Author')->with('Author')->find(); 394 * 395 * @return sfDoctrineFinder the current finder object 396 */ 279 397 public function with($classes) 280 398 { … … 284 402 } 285 403 404 /** 405 * Ask the finder to hydrate related i18n records 406 * 407 * @param string $culture Optional culture value. If no culture is given, the current user's culture is used 408 * 409 * @return sfDoctrineFinder the current finder object 410 */ 286 411 public function withI18n($culture = null) 287 412 { … … 291 416 } 292 417 418 /** 419 * Ask the finder to hydrate related columns 420 * Columns hydrated by way of withColumn() can be retrieved on the object via getColumn() 421 * If the join was not explicitly declared earlier in the finder, it guesses it 422 * Examples: 423 * $article = $articleFinder->join('Author')->withColumn('Author.Name')->findOne(); 424 * // The join() can be omitted, in which case the finder will try to guess the join based on the schema 425 * $article = $articleFinder->withColumn('Author.Name')->findOne(); 426 * // Columns added by way of withColumn() can be retrieved by getColumn() 427 * $authorName = $article->getColumn('Author.Name'); 428 * 429 * // Alias support 430 * $article = $articleFinder->withColumn('Author.Name', 'authorName')->findOne(); 431 * $authorName = $article->getColumn('authorName'); 432 * 433 * // type support 434 * $article = $articleFinder->withColumn('Author.Name', 'authorName', 'string')->findOne(); 435 * $authorName = $article->getColumn('authorName'); 436 * 437 * // Support for calculated columns 438 * $articles = articleFinder-> 439 * join('Comment')-> 440 * withColumn('COUNT(comment.ID)', 'NbComments')-> 441 * groupBy('Article.Id')-> 442 * find(); 443 * 444 * @param string $column The column to add. Can be a calculated column 445 * @param string $alias Optional alias for column retrieval 446 * @param string $type Optional type converter to be sure the retrieved column has the correct type 447 * 448 * @return sfDoctrineFinder the current finder object 449 */ 293 450 public function withColumn($column, $alias = null, $type = null) 294 451 { … … 300 457 // Finder Filters 301 458 459 /** 460 * Finder Fluid Interface for Doctrine_Query::distinct() 461 * 462 * @return sfDoctrineFinder the current finder object 463 */ 302 464 public function distinct() 303 465 { … … 361 523 * 362 524 * @see where() 525 * @return sfDoctrineFinder the current finder object 363 526 */ 364 527 public function _and() … … 376 539 * @param string $value Value if 3 arguments (optional) 377 540 * 378 * @return sf PropelFinder the current finder object541 * @return sfDoctrineFinder the current finder object 379 542 */ 380 543 public function _or() … … 394 557 * 395 558 * @see where() 559 * @return sfDoctrineFinder the current finder object 396 560 */ 397 561 public function combine($conditions, $operator = 'and', $namedCondition = null) … … 406 570 * Examples: 407 571 * $commentFinder->relatedTo($article) 572 * 573 * @param Doctrine_Record $object The related object to restrict to 574 * 575 * @return sfDoctrineFinder the current finder object 408 576 */ 409 577 public function relatedTo($object) … … 414 582 } 415 583 584 /** 585 * Finder Fluid Interface for Doctrine_Query::orderby() 586 * Infers $column and $order from $columnName and some optional arguments 587 * Examples: 588 * $articleFinder->orderBy('CreatedAt') 589 * => $query->orderBy('Article.created_at asc') 590 * $articlefinder->orderBy('CategoryId', 'desc') 591 * => $query->orderBy('Article.category_id desc') 592 * 593 * @param string $columnName The column to order by 594 * @param string $order The sorting order. 'asc' by default, also accepts 'desc' 595 * 596 * @return sfDoctrineFinder the current finder object 597 */ 416 598 public function orderBy($columnName, $order = 'asc') 417 599 { … … 425 607 return $this; 426 608 } 427 609 610 /** 611 * Finder Fluid Interface for Doctrine_Query::groupBy() 612 * Infers $column and $order from $columnName and some optional arguments 613 * Examples: 614 * $articleFinder->groupBy('CreatedAt') 615 * => $query->groupBy('Article.created_at') 616 * 617 * @param string $columnName The column to group by 618 * 619 * @return sfDoctrineFinder the current finder object 620 */ 428 621 public function groupBy($columnName) 429 622 { … … 433 626 } 434 627 628 /** 629 * Finder Fluid Interface for Doctrine_Query::groupBy() but this times we add all columns from given class. 630 * Examples: 631 * $articleFinder->groupBy('Article') 632 * => $query->groupBy('Article.id')->groupBy('Article.title')->groupBy('Article.created_at') 633 * @param string $class 634 * 635 * @return sfDoctrineFinder the current finder object 636 */ 637 public function groupByClass($class) 638 { 639 throw new Exception('This method is not yet implemented'); 640 641 return $this; 642 } 435 643 /** 436 644 * Guess sort column based on their names … … 455 663 } 456 664 457 throw new Exception('Unable to figure out the column to use to order rows in sf PropelFinder::guessOrder()');665 throw new Exception('Unable to figure out the column to use to order rows in sfDoctrineFinder::guessOrder()'); 458 666 } 459 667 … … 492 700 } 493 701 494 495 /**702 /** 703 * Finder Fluid Interface for Doctrine_Query::join() 496 704 * Infers $column1, $column2 and $operator from $relatedClass and some optional arguments 705 * Uses table introspection to guess the related columns 706 * Examples: 707 * $articleFinder->join('Comment') 708 * $articleFinder->join('Category', 'RIGHT JOIN') 709 * $articleFinder->join('Article.CategoryId', 'Category.Id', 'RIGHT JOIN') 710 * 711 * @param string $classOrColumn Class to join if 1 argument, first column of the join otherwise 712 * @param string $column Second column of the join if more than 1 argument 713 * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' 714 * 715 * @return sfDoctrineFinder the current finder object 497 716 */ 498 717 public function join() … … 503 722 } 504 723 724 /** 725 * Do no reinitialize the finder object after a termination method 726 * By default the Doctrine_Query is wiped off whenever a termination method is called 727 * Calling this method with true as parameter will keep the internal Query intact for the next termination method 728 * 729 * @param Boolean $keep true (default) or false 730 * 731 * @return sfDoctrineFinder the current finder object 732 */ 505 733 public function keepQuery($keep = true) 506 734 { … … 515 743 } 516 744 745 /** 746 * Guess the relation to another class 747 * 748 * @param string $phpName Doctrine_Record Class name (e.g. 'Article') 749 * 750 * @return array A list with the two columns member of the relationship 751 */ 517 752 public function getRelation($phpName) 518 753 { … … 520 755 } 521 756 757 /** 758 * Finds a relation between two classes by introspection 759 */ 522 760 protected function findRelation($phpName, $peerClass) 523 761 { … … 527 765 /** 528 766 * Behavior-like supplementary getter for supplementary columns added by way of withColumn() 767 * 768 * @param Doctrine_Record $object Doctrine model object 769 * @param string $alias Supplementary column name 770 * 771 * @return mixed The value of the column set by setColumn() 529 772 */ 530 773 public function getColumn($object, $alias) … … 532 775 throw new Exception('This method is not yet implemented'); 533 776 } 534 777 778 /** 779 * Behavior-like supplementary setter for supplementary columns added by way of withColumn() 780 * 781 * @param Doctrine_Record $object Doctrine model object 782 * @param string $alias Supplementary column name 783 * @param mixed The value of the column 784 */ 535 785 public function setColumn($object, $alias, $value) 536 786 { plugins/sfPropelFinderPlugin/lib/sfPropelFinder.php
r10664 r10666 145 145 // Finder Executers 146 146 147 /** 148 * Returns the number of records matching the finder 149 * 150 * @param Boolean $distinct Whether the count query has to add a DISTINCT keyword 151 * 152 * @return integer Number of records matching the finder 153 */ 147 154 public function count($distinct = false) 148 155 { … … 153 160 } 154 161 162 /** 163 * Executes the finder and returns the matching Propel objects 164 * 165 * @param integer $limit Optional maximum number of results to retrieve 166 * 167 * @return array A list of BaseObject Propel objects 168 */ 155 169 public function find($limit = null) 156 170 { … … 165 179 } 166 180 181 /** 182 * Limits the search to a single result, and executes the finder 183 * Returns the first Propel object matching the finder 184 * 185 * @return mixed a BaseObject object or null 186 */ 167 187 public function findOne() 168 188 { … … 174 194 } 175 195 176 public function findLast($column = null) 177 { 178 if($column) 179 { 180 $this->orderBy($column, 'desc'); 196 /** 197 * Returns the last record matching the finder 198 * Optionally, you can specify the column to sort on 199 * If no column is passed, the finder guesses the column to use 200 * @see guessOrder() 201 * 202 * @param string $columnName Optional: The column to order by 203 * 204 * @return mixed a BaseObject object or null 205 */ 206 public function findLast($columnName = null) 207 { 208 if($columnName) 209 { 210 $this->orderBy($columnName, 'desc'); 181 211 } 182 212 else … … 188 218 } 189 219 190 public function findFirst($column = null) 191 { 192 if($column) 193 { 194 $this->orderBy($column, 'asc'); 220 /** 221 * Returns the first record matching the finder 222 * Optionally, you can specify the column to sort on 223 * If no column is passed, the finder guesses the column to use 224 * @see guessOrder() 225 * 226 * @param string $columnName Optional: The column to order by 227 * 228 * @return mixed a BaseObject object or null 229 */ 230 public function findFirst($columnName = null) 231 { 232 if($columnName) 233 { 234 $this->orderBy($columnName, 'asc'); 195 235 } 196 236 else … … 202 242 } 203 243 244 /** 245 * Adds a condition on a column and returns the records matching the finder 246 * 247 * @param string $columnName Name of the columns 248 * @param mixed $value 249 * @param integer $limit Optional maximum number of records to return 250 * 251 * @return array A list of BaseObject Propel objects 252 */ 204 253 public function findBy($columnName, $value, $limit = null) 205 254 { … … 209 258 return $this->find($limit); 210 259 } 211 260 261 /** 262 * Adds a condition on a column and returns the first record matching the finder 263 * Useful to retrieve objects by a column which is not the primary key 264 * 265 * @param string $columnName Name of the columns 266 * @param mixed $value 267 * 268 * @return mixed a BaseObject object or null 269 */ 212 270 public function findOneBy($columnName, $value) 213 271 { … … 218 276 } 219 277 278 /** 279 * Finds record(s) based on one or several primary keys 280 * Takes into account hydrating methods previously called on the finder 281 * 282 * @param mixed $pk A primary kay, a composite primary key, or an array of primary keys 283 * 284 * @return mixed One or several BaseObject records (based on the input) 285 */ 220 286 public function findPk($pk) 221 287 { … … 300 366 } 301 367 368 /** 369 * Prepares a pager based on the finder 370 * The pager is initialized (it knows how many pages it contains) 371 * But it won't be populated until you call getResults() on it 372 * 373 * @param integer $page The current page (1 by default) 374 * @param integer $maxPerPage The maximum number of results per page (10 by default) 375 * 376 * @return sfPropelFinderPager The initialized pager object 377 */ 302 378 public function paginate($page = 1, $maxPerPage = 10) 303 379 { … … 367 443 } 368 444 445 /** 446 * Cleans up the query object (if necessary) and logs the latest query 447 * 448 * @return sfPropelFinder the current finder object 449 */ 369 450 protected function cleanup() 370 451 { … … 378 459 } 379 460 461 /** 462 * Finalizes the query, executes it and hydrates results 463 * 464 * @return array List of Propel objects 465 */ 380 466 public function doFind() 381 467 { … … 571 657 // Hydrating 572 658 659 /** 660 * Ask the finder to hydrate related records 661 * With a single class, it is equivalent to Propel's doSelectJoinXXX() methods 662 * But it accepts several arguments, so you can hydrate a lot of related objects 663 * Examples: 664 * // Article has an author, article has a category, and author has a group 665 * $articleFinder->with('Author')->find(); 666 * $articleFinder->with('Author', 'Category')->find(); 667 * $articleFinder->with('Author', 'Group')->find(); 668 * $articleFinder->join('Author')->with('Group')->find(); 669 * // By default, the finder uses a simple join (where) but you can force another join 670 * $articleFinder->leftJoin('Author')->with('Author')->find(); 671 * 672 * @return sfPropelFinder the current finder object 673 */ 573 674 public function with($classes) 574 675 { … … 592 693 } 593 694 695 /** 696 * Ask the finder to hydrate related i18n records 697 * 698 * @param string $culture Optional culture value. If no culture is given, the current user's culture is used 699 * 700 * @return sfPropelFinder the current finder object 701 */ 594 702 public function withI18n($culture = null) 595 703 { … … 602 710 } 603 711 712 /** 713 * Ask the finder to hydrate related columns 714 * Columns hydrated by way of withColumn() can be retrieved on the object via getColumn() 715 * If the join was not explicitly declared earlier in the finder, it guesses it 716 * Examples: 717 * $article = $articleFinder->join('Author')->withColumn('Author.Name')->findOne(); 718 * // The join() can be omitted, in which case the finder will try to guess the join based on the schema 719 * $article = $articleFinder->withColumn('Author.Name')->findOne(); 720 * // Columns added by way of withColumn() can be retrieved by getColumn() 721 * $authorName = $article->getColumn('Author.Name'); 722 * 723 * // Alias support 724 * $article = $articleFinder->withColumn('Author.Name', 'authorName')->findOne(); 725 * $authorName = $article->getColumn('authorName'); 726 * 727 * // type support 728 * $article = $articleFinder->withColumn('Author.Name', 'authorName', 'string')->findOne(); 729 * $authorName = $article->getColumn('authorName'); 730 * 731 * // Support for calculated columns 732 * $articles = articleFinder-> 733 * join('Comment')-> 734 * withColumn('COUNT(comment.ID)', 'NbComments')-> 735 * groupBy('Article.Id')-> 736 * find(); 737 * 738 * @param string $column The column to add. Can be a calculated column 739 * @param string $alias Optional alias for column retrieval 740 * @param string $type Optional type converter to be sure the retrieved column has the correct type 741 * 742 * @return sfPropelFinder the current finder object 743 */ 604 744 public function withColumn($column, $alias = null, $type = null) 605 745 { … … 637 777 /** 638 778 * Finder Fluid Interface for Criteria::setDistinct() 779 * 780 * @return sfPropelFinder the current finder object 639 781 */ 640 782 public function distinct() … … 690 832 * 691 833 * @see where() 834 * @return sfPropelFinder the current finder object 692 835 */ 693 836 public function _and() … … 756 899 * 757 900 * @see where() 901 * @return sfPropelFinder the current finder object 758 902 */ 759 903 public function combine($conditions, $operator = 'and', $namedCondition = null) … … 824 968 * $commentFinder->relatedTo($article) 825 969 * => $c->add(CommentPeer::ARTICLE_ID, $article->getId()) 970 * 971 * @param BaseObject $object The related object to restrict to 972 * @return sfPropelFinder the current finder object 826 973 */ 827 974 public function relatedTo($object) … … 848 995 * $articlefinder->orderBy('CategoryId', 'desc') 849 996 * => $c->addDescendingOrderByColumn(ArticlePeer::CATEGORY_ID) 850 */ 851 public function orderBy($columnName, $arguments = array()) 997 * 998 * @param string $columnName The column to order by 999 * @param string $order The sorting order. 'asc' by default, also accepts 'desc' 1000 * 1001 * @return sfPropelFinder the current finder object 1002 */ 1003 public function orderBy($columnName, $order = null) 852 1004 { 853 1005 $column = $this->getColName($columnName); 854 if(!is_array($arguments))855 {856 $arguments = func_get_args();857 array_shift($arguments);858 }859 $order = strtoupper(array_shift($arguments));860 1006 if(!$order) 861 1007 { 862 1008 $order = Criteria::ASC; 1009 } 1010 else 1011 { 1012 $order = strtoupper($order); 863 1013 } 864 1014 … … 884 1034 * $articleFinder->groupBy('CreatedAt') 885 1035 * => $c->addGroupByColumn(ArticlePeer::CREATED_AT) 1036 * 1037 * @param string $columnName The column to group by 1038 * 1039 * @return sfPropelFinder the current finder object 886 1040 */ 887 1041 public function groupBy($columnName) … … 900 1054 * @param string $class 901 1055 * 902 * @return sfPropelFinder 1056 * @return sfPropelFinder the current finder object 903 1057 */ 904 1058 public function groupByClass($class) … … 922 1076 * @param string $direction 'desc' (default) or 'asc' 923 1077 * 924 * @return sfPropelFinder $thisthe current finder object1078 * @return sfPropelFinder the current finder object 925 1079 */ 926 1080 public function guessOrder($direction = 'desc') … … 954 1108 * $articleFinder->join('Article.CategoryId', 'Category.Id', 'RIGHT JOIN') 955 1109 * => $c->addJoin(ArticlePeer::CATEGORY_ID, CategoryPeer::ID, Criteria::RIGHT_JOIN) 1110 * 1111 * @param string $classOrColumn Class to join if 1 argument, first column of the join otherwise 1112 * @param string $column Second column of the join if more than 1 argument 1113 * @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join' 1114 * 1115 * @return sfPropelFinder the current finder object 956 1116 */ 957 1117 public function join() … … 994 1154 } 995 1155 1156 /** 1157 * Do no reinitialize the finder object after a termination method 1158 * By default the Criteria is wiped off whenever a termination method is called 1159 * Calling this method with true as parameter will keep the internal Criteria intact for the next termination method 1160 * 1161 * @param Boolean $keep true (default) or false 1162 * 1163 * @return sfPropelFinder the current finder object 1164 */ 996 1165 public function keepQuery($keep = true) 997 1166 { … … 1006 1175 } 1007 1176 1177 /** 1178 * Guess the relation to another class 1179 * 1180 * @param string $phpName Propel Class name (e.g. 'Article') 1181 * 1182 * @return array A list with the two columns member of the relationship 1183 */ 1008 1184 public function getRelation($phpName) 1009 1185 { … … 1026 1202 } 1027 1203 1204 /** 1205 * Finds a relation between two classes by introspection 1206 */ 1028 1207 protected function findRelation($phpName, $peerClass) 1029 1208 { … … 1065 1244 * Behavior-like supplementary getter for supplementary columns added by way of withColumn() 1066 1245 * Requires symfony and sfMixer enabled 1246 * 1247 * @param BaseObject $object Propel object 1248 * @param string $alias Supplementary column name 1249 * 1250 * @return mixed The value of the column set by setColumn() 1067 1251 */ 1068 1252 public function getColumn($object, $alias) 1069 1253 { 1070 1254 $alias = 'a'.md5($alias); 1255 1071 1256 return $object->$alias; 1072 1257 } 1073 1258 1259 /** 1260 * Behavior-like supplementary setter for supplementary columns added by way of withColumn() 1261 * Requires symfony and sfMixer enabled 1262 * 1263 * @param BaseObject $object Propel object 1264 * @param string $alias Supplementary column name 1265 * @param mixed The value of the column 1266 */ 1074 1267 public function setColumn($object, $alias, $value) 1075 1268 { … … 1078 1271 } 1079 1272 1273 /** 1274 * Makes an empty Criteria match all records 1275 * Some Propel Methods (like doDelete()) need a Criteria with at least one condition to execute 1276 * To match all records, this methods adds a condition which is always true 1277 * 1278 * @param Criteria $c The Criteria object to make true 1279 * 1280 * @return Criteria A true Criteria 1281 */ 1080 1282 protected function addTrueCondition(Criteria $c) 1081 1283 { … … 1153 1355 if(strpos($name, 'orderBy') === 0) 1154 1356 { 1155 return $this->orderBy(substr($name, 7), $arguments); 1357 array_unshift($arguments, substr($name, 7)); 1358 return call_user_func_array(array($this, 'orderBy'), $arguments); 1156 1359 } 1157 1360 if(strpos($name, 'groupBy') === 0) 1158 1361 { 1159 return $this->groupBy(substr($name, 7), $arguments); 1362 array_unshift($arguments, substr($name, 7)); 1363 return call_user_func_array(array($this, 'groupBy'), $arguments); 1160 1364 } 1161 1365 if(strpos($name, 'join') === 0) 1162 1366 { 1163 return $this->join(substr($name, 4), $arguments); 1367 array_unshift($arguments, substr($name, 4)); 1368 return call_user_func_array(array($this, 'join'), $arguments); 1369 1164 1370 } 1165 1371 if(($pos = strpos($name, 'Join')) > 0)