Posts tagged: doctrine

weird doctrine overrides

I found a little strange behaviour when trying to override the constructor of a class in the doctrine ORM framework. I have this really small example, a party with guests n:m class Guest extends Doctrine_Record { public function __construct($firstname=null, $lastname=null) { parent::__construct(); if ($firstname) $this->firstname = $firstname; if ($lastname) $this->lastname = $lastname; } public function [...]

Donnerstag Dezember 17th, 2009 in , , | 1 Comment »

doctrine generate php script

a sample script to build your database or models // generate.php require_once(‘bootstrap_build.php’); if (!in_array($argv[1], array(“yaml”, “models”))) exit(1); Doctrine_Core::dropDatabases(); Doctrine_Core::createDatabases(); if ($argv[1] == “models”) { Doctrine_Core::generateModelsFromYaml(‘schema.yml’, ‘models’); } if ($argv[1] == “yaml”) { Doctrine_Core::generateYamlFromModels(‘schema.yml’, ‘models’); } Doctrine_Core::createTablesFromModels(‘models’);

Montag Dezember 14th, 2009 in , , | No Comments »