[Phpwm] [phpwm] Database extraction
Gavin Kimpson
gkimpson at gmail.com
Fri Apr 9 15:27:31 UTC 2010
Thanks Adam!! That was a really comprehensive explanation of Propel,
looks impressive too - i'll certainly have a good look at that one
over the weekend :-)
Thanks again!
On Fri, Apr 9, 2010 at 4:16 PM, Adam Smith <adam.smith at mobilefun.co.uk> wrote:
> Hey Gav,
> I think you mean 'database abstraction', our team has found that propel is
> more than enough for our needs, you specify a schema in xml which is
> relatively straight forward and you define table relations in the schema as
> well. It will produce the create sql statements and then generate classes
> for your tables. You can then easily extends them by modifying the class.
> You then do queries by either selecting by id from the 'peer' object, for
> example:
> $product = ProductPeer::retrieveByPK($id);
> or you can create a criteria:
> $c = new Criteria();
> $c->add(ProductPeer::PRODUCT_STATUS, 45);
> $c->add(ProductPeer::ACTIVE, true);
> $products = ProductPeer::doSelect($c);
> retrieving cell values is easy:
> $product_name = $product->getName();
> modifying elements is easy enough, if a product has a name you modify it by:
> $product->setName($new_name);
> and to save changes:
> $product->save();
> and if you want to delete from the database:
> $product->delete();
> Additionally if a category has products you can get them using:
> $category->getProducts();
> Although this requires you to specify a name for the relation in the schema.
> Hope this is helpful.
> Kind Regards,
> Adam Smith
>
> _______________________________________________
> Phpwm mailing list
> Website : http://www.phpwm.org
> Twitter : http://www.twitter.com/phpwm
> Facebook: http://www.facebook.com/group.php?gid=2361609907
>
> Post to list: Phpwm at mailman.lug.org.uk
> Archive etc : https://mailman.lug.org.uk/mailman/listinfo/phpwm
>
More information about the Phpwm
mailing list