#381: Doctrine Inclusion
-----------------------------------+----------------------------------------
 Reporter:  [EMAIL PROTECTED]  |       Owner:  david
     Type:  enhancement            |      Status:  new  
 Priority:  normal                 |   Milestone:  0.11 
Component:  _OTHER_                |     Version:  HEAD 
 Severity:  normal                 |    Keywords:       
-----------------------------------+----------------------------------------
 Hi all,

 Attached are two files for inclusion for Doctrine support:

  1. !DoctrineAgaviDatabase.class.php - which handles the database
 connection via a full dsn in databases.xml (i.e.
 !mysql://root:[EMAIL PROTECTED]/doctrine) and handles the autoloading of
 classes as long as they follow the agavi Model format
  2. !AgaviDoctrineRecord.class.php - which is a helper wrapper for the
 Models to implement

 So add them to the base autoload.xml and support for Doctrine is there!


 Example Usage:
 {{{
   // Establish connection
   $conn = $this->getContext()->getDatabaseConnection();
   // Get the model
   $user = $this->getContext()->getModel('User');

   // Do something with the model
   $user->name = "Jack Daniels";
   $user->Email->address = "[EMAIL PROTECTED]";
   $user->Phonenumber[0]->phonenumber = "123 123";
   $user->Phonenumber[1]->phonenumber = "133 133";
   $user->Group[0]->name = "beer lovers";
   $user->Group[0]->Email->address = "[EMAIL PROTECTED]";
   $user->save();

 }}}

 Note: Because Doctrine initiates any sub classes i.e. the Email class
 belonging to User is auto initiated by Doctrine it doesn't have access to
 context via getContext where as the User model does because we initiated
 it through getModel

 Ross

-- 
Ticket URL: <http://trac.agavi.org/ticket/381>
Agavi <http://www.agavi.org/>
An MVC Framework for PHP5


_______________________________________________
Agavi Tickets Mailing List
[email protected]
http://lists.agavi.org/mailman/listinfo/tickets

Reply via email to