Changeset 10808
- Timestamp:
- 08/12/08 15:30:29 (3 months ago)
- Files:
-
- plugins/sfPropelFinderPlugin/README (modified) (9 diffs)
- plugins/sfPropelFinderPlugin/package.xml (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/sfPropelFinderPlugin/README
r10805 r10808 11 11 * a compatibility layer to allow plugins to work with both Propel and Doctrine 12 12 13 Warning: The Doctrine implementation is not yet complete. The syntax described below works completely with Propel 1.2 and 1.3, and partially with doctrine 0.11. 14 13 15 Overview 14 16 -------- … … 44 46 * Install the plugin 45 47 46 > php symfony plugin-install http://plugins.symfony-project.com/ sfPropelFinderPlugin48 > php symfony plugin-install http://plugins.symfony-project.com/DbFinderPlugin 47 49 48 50 * Clear the cache … … 239 241 ### Complex logic 240 242 241 // where() and _or() only allow simple logical operations on a single condition243 // where() and orWhere() only allow simple logical operations on a single condition 242 244 // For more complex logic, you have to use combine() 243 245 // It expects an array of named conditions to be combined, and an operator … … 347 349 Warning: The `withColumn()` feature requires symfony's Behavior system. It will only work if you enable behaviors in `propel.ini` and rebuild your model afterwards. 348 350 349 350 351 $article = DbFinder::from('Article')-> 351 352 join('Category')-> … … 398 399 399 400 ### Getting a paginated list of results 400 401 401 402 402 // Getting an initialized sfPropelPager object … … 451 451 You can create a new finder for your objects, with custom methods. The only prerequisites are to extend `DbFinder`, and to define a protected `$class` property. 452 452 453 For instance, you can create an child of ` sfModelFinder` to retrieve Propel `Article` objects. This new finder has access to a protected query object by way of `getQueryObject()`. This object is a Propel Criteria that can be augmented in the usual way. Don't forget to return the current object (`$this`) in the new methods.453 For instance, you can create an child of `DbFinder` to retrieve Propel `Article` objects. This new finder has access to a protected query object by way of `getQueryObject()`. This object is a Propel Criteria that can be augmented in the usual way. Don't forget to return the current object (`$this`) in the new methods. 454 454 455 455 class ArticleFinder extends DbFinder … … 469 469 find(); 470 470 471 **Tip**: Once you define an `ArticleFinder` class, any call to `DbFinder::from('Article')` will return an instance of `ArticleFinder` instead of an instance of `DbFinder`. This also means that you can use the finder API to query model objects that are not backed by any ORM at all. 471 **Tip**: Once you define an `ArticleFinder` class, any call to `DbFinder::from('Article')` will return an instance of `ArticleFinder` instead of an instance of `DbFinder`. So the following also works: 472 473 $articleFinder = DbFinder::from('Article')-> 474 recent()-> 475 orderByTitle()-> 476 find(); 477 478 This also means that you can use the finder API to query model objects that are not backed by any ORM at all. 472 479 473 480 ### Finding Objects From A Primary Key … … 525 532 * Handle self-referencing relationships (e.g. parent_id), especially in with() 526 533 * Handle multiple references to the same table (c.f. getFooRelatedByBarId()) 527 * Put as a parent class in the PeerBuilder so that every Peer class can be a finder528 * Merge with sfPropelImpersonatorPlugin!529 534 * Implement iterator interface? That way, the query is only executed upon a foreach or an array access... And the finder can be seen as a collection 530 535 * Column finder, which provides an easy interface to Creole (and PDO) for retrieval of columns instead of objects? … … 533 538 --------- 534 539 535 ### 2008-08-12 | Trunk 536 540 ### 2008-08-12 | 0.4.0 Beta 541 542 * francois: Renamed the plugin to `DbFinder` 537 543 * francois: Added `finder_methods` parameter in `generator.yml` 538 544 * francois: Implemented `not in` comparison in `sfDoctrineFinder::where()` plugins/sfPropelFinderPlugin/package.xml
r10168 r10808 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 2 <package xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" packagerversion="1.4.1" version="2.0" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd"> 3 <name> sfPropelFinderPlugin</name>3 <name>DbFinderPlugin</name> 4 4 <channel>pear.symfony-project.com</channel> 5 <summary>Propel object finder</summary> 6 <description>The `sfPropelFinder` is a symfony plugin that provides an easy API for finding Propel objects - that is, easier than the Peer methods and the Criteria stuff.</description> 5 <summary>The `DbFinder` is a symfony plugin that provides an easy API for finding Model objects, whether the underlying ORM is Propel or Doctrine.</summary> 6 <description>`DbFinder` can be seen as: 7 8 * a usability layer to ease the use of Propel's Criteria object and Peer classes 9 * an extension to Propel's limited capabilities to provide: 10 - complex joins 11 - custom hydration of related objects and columns 12 - schema and relation introspection 13 * a compatibility layer to allow plugins to work with both Propel and Doctrine 14 </description> 7 15 <lead> 8 16 <name>Francois Zaninotto</name> … … 11 19 <active>yes</active> 12 20 </lead> 13 <date>2008-0 7-07</date>21 <date>2008-08-12</date> 14 22 <version> 15 <release>0. 3.0</release>16 <api>0. 3.0</api>23 <release>0.4.0</release> 24 <api>0.4.0</api> 17 25 </version> 18 26 <stability> … … 25 33 <dir name="/"> 26 34 <file name="README" role="data"/> 35 <file name="README_generator" role="data"/> 27 36 <file name="LICENSE" role="data"/> 37 <dir name="data"> 38 <dir name="generator"> 39 <dir name="DbFinderAdmin"> 40 <dir name="default"> 41 <dir name="skeleton"> 42 <dir name="actions"> 43 <file name="actions.class.php" role="data"/> 44 </dir> 45 <dir name="config"> 46 <file name="generator.yml" role="data"/> 47 </dir> 48 <dir name="templates"/> 49 <dir name="validate"/> 50 </dir> 51 <dir name="template"> 52 <dir name="actions"> 53 <file name="actions.class.php" role="data"/> 54 </dir> 55 <dir name="templates"> 56 <file name="_edit_actions.php" role="data"/> 57 <file name="_edit_footer.php" role="data"/> 58 <file name="_edit_form.php" role="data"/> 59 <file name="_edit_header.php" role="data"/> 60 <file name="_edit_messages.php" role="data"/> 61 <file name="_filters.php" role="data"/> 62 <file name="_list.php" role="data"/> 63 <file name="_list_actions.php" role="data"/> 64 <file name="_list_footer.php" role="data"/> 65 <file name="_list_header.php" role="data"/> 66 <file name="_list_messages.php" role="data"/> 67 <file name="_list_td_actions.php" role="data"/> 68 <file name="_list_td_stacked.php" role="data"/> 69 <file name="_list_td_tabular.php" role="data"/> 70 <file name="_list_th_stacked.php" role="data"/> 71 <file name="_list_th_tabular.php" role="data"/> 72 <file name="editSuccess.php" role="data"/> 73 <file name="listSuccess.php" role="data"/> 74 </dir> 75 </dir> 76 </dir> 77 </dir> 78 </dir> 79 </dir> 28 80 <dir name="lib"> 81 <dir name="generator"> 82 <file name="DbFinderAdminGenerator.class.php" role="data"/> 83 </dir> 84 <file name="DbFinder.php" role="data"/> 85 <file name="sfDoctrineFinder.php" role="data"/> 86 <file name="sfDoctrineFinderListener.php" role="data"/> 87 <file name="sfModelFinder.php" role="data"/> 29 88 <file name="sfPropelFinder.php" role="data"/> 30 89 <file name="sfPropelFinderPager.php" role="data"/>