NYCPHP Meetup

NYPHP.org

[nycphp-talk] Templating engines

Guilherme Blanco guilhermeblanco at gmail.com
Fri Jan 18 07:35:36 EST 2008


Sorry,


I'd not interrupt the entire discussion... but something here is wrong.
Read my comments just after what the user said:


On Jan 18, 2008 1:53 AM, Paul Houle <paul at devonianfarm.com> wrote:
> Ajai Khattri wrote:
> > On Thu, 17 Jan 2008, paul at devonianfarm.com wrote:
> >
> >
> >> Symfony has a mature view system that has caching and other advanced
> >> features (I wish I could say it was as mature in the data access department)
> >>
> >
> > Care to elaborate?
> >
> > Also, have you played with Doctrine much?
> >
> >
>     The more I've thought about it,  the more I like the basic approach
> of Propel.  (In fact,  today I was working on a data access layer for an
> ASP.NET application and ended up building a "Peer" class because needed
> some place to stick the static methods associated with a particular
> database table.)
>
>     Symfony/Propel fails seriously,  however,  when it comes to database
> maintainability.
>
>     You're left high and dry if you do things the "symfony" way of
> writing your schema files and building a database from that.  Want to do
> something simple like add a column?  There's no way to do it other than
> to make a change in the schema and ~then~ make a change in the database.
>

Propel is rigid on Join conditions and you're unable to fetch for
something like...

Users -> Related Permissions to Users -> Permissions -> Permissions Categories

Doctrine enables you to do it. Continue reading... =)


>     Things get really hairy when you install a plugin or two...  I used
> sf_comment to add comments to this site:
>
> http://spoonriveranthology.net/spoon/river/
>
>     I followed the install instructions for sf_comment and found that
> the build scripts trashed my database.  Symfony plug-ins are based on
> the assumption that you design the database,  build the site out and
> never change it.
>
>     Now,  there is a way out,  and that's the strategy of having the
> 'official' copy of the database schema be in the database and build your
> propel schema from that.  I've had reasonable results that way,  but
> have run into two problems:
>
> (i) if you don't follow certain (unwritten) conventions in how your
> tables and columns are named,  Propel might build weird database
> bindings or might build database bindings that don't compile.  For
> instance,  I inherited a database that had a field named 'count'.  Maybe
> you're not supposed to do that (count is a mysql function) but the
> database worked just fine until Propel got involved.
> (ii) I'm not entirely happy with how foreign keys work,  at least with a
> mysql back end.  Foreign keys get imported in the schema,  almost
> correctly,  if you're running an innodb database,  but not if you're
> running myisam (which doesn't keep the metadata.)  It would be really
> nice to have a place to keep hints about foreign keys that get merged
> with fresh info from the database schema.
>
> --------
>
> Doctrine?  On paper doctrine looks great.  The migration mechanism looks
> promising and so does the query language.  In practice,  documentation
> is lacking.  For instance,
>
> http://trac.symfony-project.com/wiki/sfDoctrinePlugin1.1
>
> Doesn't say a word about how you configure your database connections or
> how you build your model from your schemas.  It would be really nice to
> have a sample app based on Doctrine that you can install by going down a
> checklist.  That's how Doctrine fails the maturity test.  Every symfony
> project I've done in the last few months has been something where I need
> to deliver some real functionality in a few hours...  I can either get
> the job done with Propel,  where I'm up on the learning curve,  or I
> could mess around for twice as long to get it working with Doctrine...
> Only to find that I did it my own way rather than a standardized
> framework way.

Doctrine is the best ORM for PHP available today. It is still under
heavy development and has some serious bugs, but it still keep the
first place when talking about ORM.

Symfony's Doctrine documentation is small and there are 2 places where
you need to check to get the desirable information. Since the method
to generate models from schema haven't changed, it was only documented
in 0.1 manual (something I really don't like, but anyway...).

Just to get things clear, I'll answer your wishes:


Doesn't say a word about how you configure your database connections

http://trac.symfony-project.com/wiki/sfDoctrinePlugin1.1

Just after the installation process, it describes how to define
database connections.




how you build your model from your schemas

http://trac.symfony-project.com/wiki/sfDoctrinePlugin0.1

Here you'll find a more extensive documentation about how to use
Doctrine under sf. You'll even find some information regarding how to
write schemas, but I really suggest you to check the official Doctrine
manual to do it.
Also, in this page you'll see how to generate your models, generate
sql and also run the sql on database.

And if you don't feel comfortable or something simply does not work
for you, just open Konversation on server irc.freenode.net and enter
in #doctrine channel. There are a lot of people there ready to help
you. Also there are 3 or 4 mailing lists that you can send messages.

I am a Doctrine contributor, responsible for Doctrine_Pager
functionality and I never tried Symfony + Doctrine before. Until now I
used Doctrine with my own framework, but I moved from my old job to
another one.
In the beginning of this week I've been requested to start a huge
application with sf + doctrine and I didn't spend more than 1 hour to
configure everything and generate my first model (1h including read
the sf manual to install it and then read the manual to install
doctrine extension).
I know nothing about sf and I am still reading the manual. So, I don't
think it's too much difficult as you said to do it.



Best regards,


>
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php
>



-- 
Guilherme Blanco - Web Developer
CBC - Certified Bindows Consultant
Cell Phone: +55 (16) 9166-6902
MSN: guilhermeblanco at hotmail.com
URL: http://blog.bisna.com
São Carlos - SP/Brazil


More information about the talk mailing list