the dataSource plugin provides a simple interface with light weight
implementations for propel, doctrine, arrays or anything you write
yourself. Compared to dbFinder it does not provide any complex orm-
logic, this is still left to the orm of your choice which instance you
provide during construction of the datasource.

The (Propel) ObjectPath implementation only provides a small layer
(behavior) above the ORM to make simple joins possible, by recursively
parsing objectPaths: recursively defined relationNames, like
Book.Author to join a BookReview with the Book and that Book with its
Author.
The joining and hydration is still done by the ORM, the behavior
simply splits the objectPath at the first dot joins and continues
recursively.

ObjectPaths will become optional (although very useful) for the grids.

DataSources are there to provide a generic interface to access your
data, sort it and filter on it: providing basic functionality to
manipulate your dataset (from database by propel/doctrine, arrays
(json, xml, yml), imap, etc)

dbFinder was adding a generic interface as well, but added a
relatively complex interface with often complex functionality that
wasn't available in the specific orm. in the DataSource
implementations complex actions like defining complex filtering (where
clauses) or sorting can be done by specializing the propel/doctrine/
arrayDataSource implementation, leaving it up to you (and the specific
orm) to perform the complex code.



On 15 apr, 04:05, Richard U <richard....@gmail.com> wrote:
> Sorry, I am referring to the sfPropelObjectPathBehaviorPlugin
>
> On Thu, Apr 15, 2010 at 12:04 PM, Richard U <richard....@gmail.com> wrote:
> > How is the sfDataSource different from dbFinder?
>
> > On Wed, Apr 14, 2010 at 8:52 AM, Leon van der Ree <l...@fun4me.demon.nl> 
> > wrote:
> >> Hi All,
>
> >> today I have added the start of routing-engine for grids.
>
> >> DigitalBase has provided a redmine issue-tracker for us at
> >>https://symfony.digitalbase.eu/
> >> This way we can report bugs and cooperate much easier, so feel free to
> >> report and improve the plugins!
>
> >> On 12 apr, 15:11, E_lexy <alexk...@gmail.com> wrote:
> >>> Leon,
>
> >>> I just checked out all required plugins to generate a grid.
> >>> Using your old sfGridExtjs3plugin, i get inheritance errors.
> >>> it seems the sfGrid class variables cannot be reached by any subclass
> >>> (private).
> >>> When I change them to 'protected' the subclasses are allowed access
> >>> and all works fine.
>
> >>> p.s. i am very curious to see your extjs grid plugin, I have am using
> >>> old plugin so I can specify EXtjs column plugins is the meta data, and
> >>> have Extjs generate the entire grid based on the 
> >>> jsonhttp://www.extjs.com/deploy/dev/docs/source/Store.html#cls-Ext.data.S...
>
> >>> Alex
>
> >>> On Apr 12, 11:03 am, DigitalBase <i...@digitalbase.eu> wrote:
>
> >>> > Leon,
>
> >>> > i am trying out your sfGrid plugin and ran into few small issues
> >>> > where do you want us to report problems/bugs ?
>
> >>> > On Apr 11, 10:53 pm, Leon van der Ree <l...@fun4me.demon.nl> wrote:
>
> >>> > > Today I will provide a tutorial, setting up a (propel-based)
> >>> > > playground with some best practices I came up with so far. (If you
> >>> > > prefer Doctrine, you can still follow the tutorial, but of course need
> >>> > > to setup a Doctrine schema and use the Doctrine plugins)
>
> >>> > > If you want to see where all the fuzz is about, peak ahead and look at
> >>> > > the size of the controller and the template!
> >>> > > All configuration can be done in an extended
>
> >>> > > Lets begin with a new (Symfony 1.4) Project:
>
> >>> > > Tip: create a new repository on your svn-server and check this out!
> >>> > > (this is useful since we are using a lot of plugins from svn, that can
> >>> > > be updated all at once by using svn:externals )
>
> >>> > >   svn co your.svn.server/playground-project playground
> >>> > > or, when not using svn
> >>> > >   mkdir playground
>
> >>> > >   cd playground
> >>> > >   php /symfony14/data/bin/symfony generate:project --orm=propel
> >>> > > playground
>
> >>> > > we now have a new propel-based syfmony 1.4 project. Lets start by
> >>> > > adding all required Plugins:
>
> >>> > >   svn propedit svn:externals .
>
> >>> > > and add the following lines to it:
>
> >>> > > plugins/sfPropel15Pluginhttp://svn.symfony-project.com/plugins/sfPropel15Plugin/trunk
> >>> > > plugins/sfPropelObjectPathBehaviorPluginhttp://svn.symfony-project.com/plugins/sfPropelObjectPathBehaviorPlug...
> >>> > > plugins/sfDataSourcePlugin  
> >>> > > http://svn.symfony-project.com/plugins/sfDataSourcePlugin/trunk
> >>> > > plugins/sfGridPluginhttp://svn.symfony-project.com/plugins/sfGridPlugin/trunk
>
> >>> > > Now we enable our plugins, first by editing our Project configuration,
>
> >>> > > edit config/ProjectConfiguration.class.php
> >>> > > and enable your plugins in the setup-function:
>
> >>> > >     $this->enablePlugins(
> >>> > >         'sfPropel15Plugin',
> >>> > >         'sfPropelObjectPathBehaviorPlugin',
>
> >>> > > //      'sfExtjs3Plugin', // soon people
>
> >>> > >       'sfDataSourcePlugin',
> >>> > >       'sfGridPlugin' //,
> >>> > > //      'sfGridExtjsPlugin' // soon.... Just teasing ;)
> >>> > >     );
>
> >>> > > Setup propel, by editing propel.ini
> >>> > > please note propel1.5 is requiring different behavior-paths and we are
> >>> > > enabling the object-path plugin:
> >>> > > So the behaviors section should look like this:
>
> >>> > > ; behaviors
> >>> > > propel.behavior.default                        =
> >>> > > symfony,symfony_i18n,object_path
>
> >>> > > propel.behavior.symfony.class                  =
> >>> > > plugins.sfPropel15Plugin.lib.behavior.SfPropelBehaviorSymfony
> >>> > > propel.behavior.symfony_i18n.class             =
> >>> > > plugins.sfPropel15Plugin.lib.behavior.SfPropelBehaviorI18n
> >>> > > propel.behavior.symfony_i18n_translation.class =
> >>> > > plugins.sfPropel15Plugin.lib.behavior.SfPropelBehaviorI18nTranslation
> >>> > > propel.behavior.symfony_behaviors.class        =
> >>> > > plugins.sfPropel15Plugin.lib.behavior.SfPropelBehaviorSymfonyBehaviors
> >>> > > propel.behavior.symfony_timestampable.class    =
> >>> > > plugins.sfPropel15Plugin.lib.behavior.SfPropelBehaviorTimestampable
>
> >>> > > propel.behavior.object_path.class              =
> >>> > > plugins.sfPropelObjectPathBehaviorPlugin.lib.ObjectPathBehavior
>
> >>> > > Currently I have a simple schema as an example:
>
> >>> > > propel:
> >>> > >   city:
> >>> > >     id:
> >>> > >     name:       varchar(255)
> >>> > >     country_id:
> >>> > >     created_at:
>
> >>> > >   country:
> >>> > >     id:
> >>> > >     name:      varchar(255)
> >>> > >     created_at:
>
> >>> > > lets build the model
>
> >>> > >   ./symfony propel:build-all
>
> >>> > > Add an application and empty module:
>
> >>> > >   ./symfony generate:app frontend
> >>> > >   ./symfony generate: frontend cityGrid
>
> >>> > > Now add a grid folder to your lib-folder and add a CityGrid.php file
>
> >>> > >   mkdir lib/grid
> >>> > >   edit lib/grid/CityGrid.php
>
> >>> > > and add the following code to it:
>
> >>> > > <?php
> >>> > > class CityGrid extends sfWebGrid  // soon you can extend the
> >>> > > sfGridExtjs3 - class
> >>> > > {
> >>> > >   /**
> >>> > >    *
> >>> > >    * @param sfWebRequest $request
> >>> > >    */
> >>> > >   public function __construct(sfWebRequest $request)
> >>> > >   {
> >>> > >     $cityDataSource = new sfDataSourcePropel('City');
> >>> > >     parent::__construct($cityDataSource);
>
> >>> > >     $this->setDefaultSort('Country.Name', sfGrid::ASC);
>
> >>> > >     $this->setColumns(array(
> >>> > >       'Id',
> >>> > >       'Country.Name',
> >>> > >       'Name'
> >>> > >     ));
>
> >>> > >     $this->setColumnTitles(array(
> >>> > >       'Country.Name' => 'Country',
> >>> > >       'Name'         => 'City'
> >>> > >     ));
> >>> > >     $this->setSortable(sfGrid::ALL);
>
> >>> > >     $this->getPager()->setMaxPerPage(2);
> >>> > >     $this->bind($request);
> >>> > >   }
>
> >>> > > }
>
> >>> > > Now you can add the following to your controller:
>
> >>> > > edit actions.class.php
>
> >>> > >  /**
> >>> > >   * Executes index action
> >>> > >   *
> >>> > >   * @param sfRequest $request A request object
> >>> > >   */
> >>> > >   public function executeIndex(sfWebRequest $request)
>
> >>> > >     $this->grid = new CityGrid($request);
>
> >>> > >   }
>
> >>> > > And edit your template, indexSuccess.php
>
> >>> > > <?php $grid = $sf_data->getRaw('grid'); ?>
> >>> > > <div id="grid-example">
> >>> > >   <table>
> >>> > >    <?php echo $grid->render() ?>
> >>> > >   </table>
> >>> > > </div>
>
> >>> > > clear your cache
>
> >>> > >   ./symfony cc
>
> >>> > > add some data to your database, use fixtures, or the following:
>
> >>> > > // initialize database
> >>> > > $country_nl = new Country();
> >>> > > $country_nl->setName('the Netherlands');
>
> >>> > > $country_fr = new Country();
> >>> > > $country_fr->setName('France');
>
> >>> > > $country_be = new Country();
> >>> > > $country_be->setName('Belgium');
>
> >>> > > $city_ams = new City();
> >>> > > $city_ams->setCountry($country_nl);
> >>> > > $city_ams->setName('Amsterdam');
> >>> > > $city_ams->save();
>
> >>> > > $city_rdm = new City();
> >>> > > $city_rdm->setCountry($country_nl);
> >>> > > $city_rdm->setName('Rotterdam');
> >>> > > $city_rdm->save();
>
> >>> > > $city_rdm = new City();
> >>> > > $city_rdm->setCountry($country_nl);
> >>> > > $city_rdm->setName('Den Haag');
> >>> > > $city_rdm->save();
>
> >>> > > $city_prs = new City;
> >>> > > $city_prs->setName('Paris');
> >>> > > $city_prs->setCountry($country_fr);
> >>> > > $city_prs->save();
>
> >>> > > $city_bdx = new City;
> >>> > > $city_bdx->setCountry($country_fr);
> >>> > > $city_bdx->setName('Bordeaux');
> >>> > > $city_bdx->save();
>
> >>> > > $city_brs = new City();
> >>> > > $city_brs->setCountry($country_be);
> >>> > > $city_brs->setName('Brussel');
> >>> > > $city_brs->save();
>
> >>> > > next time I will release the extjsGrid. Then I will transform this
> >>> > > example to ExtJS, with only minor changes to the module and the
> >>> > > CityGrid-class.The CityGrid will specialize the ExtjsGrid, providing
> >>> > > it the capabilities to generate not only HTML, but JSON and JS output
> >>> > > as well. The controller currently needs to be altered to add support
> >>> > > to handle .js and .json requests, but I am going to make the routing
> >>> > > engine take care of that. The template currently needs to be extended
> >>> > > as well, to start the initial extjs-application, but this will be
> >>> > > moved to the extjs-grid-plugin soon as well.
>
> >>> > > For now I would be happy to get feedback about the current HTML
> >>> > > formatter.
> >>> > > I didn't explained how to modify the (row)formatter yet and how to
> >>> > > define and write widgets, but you should be aware that these are the
> >>> > > key to modifying the HTML rendering (for example to add css-classes
> >>> > > and truncate your texts or format currencies) to your liking.
>
> >> --
> >> If you want to report a vulnerability issue on symfony, please send it to 
> >> security at symfony-project.com
>
> >> You received this message because you are subscribed to the Google
> >> Groups "symfony users" group.
> >> To post to this group, send email to symfony-users@googlegroups.com
> >> To unsubscribe from this group, send email to
> >> symfony-users+unsubscr...@googlegroups.com
> >> For more options, visit this group at
> >>http://groups.google.com/group/symfony-users?hl=en
>
> >> To
>
> ...
>
> meer lezen »

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

To unsubscribe, reply using "remove me" as the subject.

Reply via email to