doctrine

What are the options available for Doctrine's Doctrine_Core::generateModelsFromDb method?

Doctrine 1.2 has a method called generateModelFromDb, documented here, that generates model files for all of the tables in a database. This function accepts an optional third parameter with an array of "options" to use when generating models, the specifics of which are not documented. What options are available for me to specify here? ...

Calling overridden method from within overriding method in OO PHP

Working in a symfony model, I want to override a function and call the overridden function from within the overriding one, along the lines of class MyClass extends BaseMyClass { function setMyProperty($p) { parent::setMyProperty($p); //do some other stuff } } This is resulting in a segmentation fault. I don't want to alt...

Doctrine lazy loading classes takes 100 ms?!

I'm lazy loading my Doctrine classes in my website. Benchmarking has showed that Doctrine::loadModels('models') takes over 100 ms to complete! I have 118 tables in total, but still... setting attribute to conservative loading: Doctrine_Manager::getInstance()->setAttribute(Doctrine::ATTR_MODEL_LOADING, Doctrine::MODEL_LOADING_CONSERVATI...

Sortable behavior for Doctrine ORM

Does anyone know of an existing implementation of a sortable behavior for Doctrine? I'm actually amazed is isn't in the default behaviors since it's such a common thing in most webapplications. ...

symfony doctrine build-sql error

I have some big problems with symfony and doctrine at the beginning of a new project. I have created database diagram with mysql workbench, inserted the sql into phpmyadmin and then I've tried symfony doctrine:build-schema to generate the YAML schema. It generates a wrong schema (relations don't have on delete/on update) and after this I...

php doctrine relational form naming for saving data

is it possible to have an html form organized/named in such a way that $foo->fromArray($_POST) would actually save relational data as well? example: html_form_fields: user_name country_name db_table_users: id user_name db_table_countries: id country_name update: forgot to say i'm trying to make this with zend framework forms ...

Doctrine 1.2: Can a model have two instances of the sluggabl behavior?

I dont see any direct mention on using multiple slugs (or any behavior for that matter) for single model. Is there a way to use the sluggable behavior to generate two separate slugs for a model? For example i need to generate two slugs for every record a product_id consisting of a slugified company name and sku and a distributor_id con...

Doctrine MYSQL 150+ tables: generating models works, but not vice-versa?

I can generate my models and schema.yml file based on an existing database. But when I try to do it the other way around using Doctrine::createTablesFromModels() i get an error: Syntax error or access violation: 1064 So either of these works: Doctrine::generateYamlFromDb(APPPATH . 'models/yaml'); Doctrine::generateYamlFrom...

Is possible overwriting a Doctrine model in Symfony?

Hi, is possible overwriting a Doctrine model in Symfony? I'm trying no change a "notnull" property, but i can get it.. In 'plugins/sfDoctrineGuardPlugin/config/doctrine/schema.yml': sfGuardUser: actAs: [Timestampable] columns: id: type: integer(4) primary: true autoincrement: true username: ...

Doctrine: Mixing YAML markup and db manager (navicat) editing?

I think the answer to this question should be: No. However I hope to be corrected. I'd like to edit our database using a mixture of YAML markup + Doctrine createTables() and Navicat editing. Can I maintain the inheritance which is marked up? Example (4 steps, at step 4, Doctrine is in no way able to re-create the inheritance schema... ...

Doctrine Problem: Couldn't get last insert identifier.

When i try to save data to my model Doctrine throws this exception: Message: Couldn't get last insert identifier. My table setup code is: $this->hasColumn('id', 'integer', 4, array( 'type' => 'integer', 'length' => 4, 'fixed' => false, 'unsigned' => false, 'primary' => true, 'aut...

Could not generate migration classes from difference (Zend Framework 1.10 + Doctrine 1.2.2)

Hello, I'm trying to perform database migration from the command line using "php doctrine generate-migrations-diff", it just gives me the error: "Could not generate migration classes from difference" Is there anyone having the same issue? I'm using Zend Framework + Doctrine 1.2.2 Thanks. ...

Doctrine 1.2: How do i prevent a contraint from being assigned to both sides of a One-to-many relation?

Is there a way to prevent Doctrine from assigning a contraint on both sides of a one-to-one relationship? Ive tried moving the definition from one side to the other and using owning side but it still places a constraint on both tables. when I only want the parent table to have a constraint - ie. its possible for the parent to not have an...

Is Doctrine able to detect n-m relations in a db using generateModelsFromDb?

When using generateModelsFromDb to generate the models Doctrine makes one to many relations between the relation table and the base tables instead of generating a nm-relation between the base tables themselves. Is there any way to let generateModelsFromDb detect the n-m relation? ...

How to define an n-m relation in doctrine?

If got a table "Article" and a table "Tags". Articles can have multiple tags and tags can hang to multiple articles. The class BaseArticle looks like this: abstract class BaseArticle extends Doctrine_Record { public function setTableDefinition() { $this->setTableName('article'); $this->hasColumn('article_id', 'integer', 8, arra...

Fatal error: Call to a member function getAttribute() on a non-object in C:\xampp\htdocs\giftshoes\system\database\doctrine\Doctrine\Record.php on line 1424

I am getting following error message when using Doctrine ORM in Codeigniter. Please help me... ------------------Doctrin Table Defination------------- abstract class BaseShoes extends Doctrine_Record { public function setTableDefinition() { $this->setTableName('shoes'); $this->hasColumn('sku', 'integer', 11, arra...

Unidirectional OneToMany in Doctrine 2

I have two Doctrine entities looking like that: /** * @Entity * @Table(name = "Locales") */ class Locale { /** * @Id @Column(type="integer") * @GeneratedValue(strategy="IDENTITY") */ private $id; /** @Column(length=2, name="Name", type="string") */ private $code; } /** * @Entity * @Table(name = "loc...

Symfony, in remote host: Error 500. Unknown record property / related component "algorithm" on "sfGuardUser"

Hi, after deploying, i get the error below after loggingin. Sf 1.3, sfDoctrineGuardPlugin. And i have this schema.yml in config/doctrine: Usuario: inheritance: extends: sfGuardUser type: simple columns: username: type: string(128) notnull: false unique: true nombre_apellidos: string(60) sexo: ...

How Doctrine saves new related objects

If I create a new Doctrine object, with lots of relations, should I save() these relations before assigning them to newly created object? E.g. $main = new Main(); $child = new Child(); $main->child_rel = $child; // do I need to save the child obj explicitly? $main->save(); I assumed that parent will automatically call cascading saves,...

Doctrine SQL query: works on MySQL, on PostgreSQL won't

This is a query automatically generated by Taggable extension for Doctrine ORM. SELECT t.id AS t__id, t.name AS t__name, COUNT(DISTINCT i.id) AS i__0, (COUNT(DISTINCT i.id)) AS i__1 FROM taggable_tag t LEFT JOIN cms__model__image_taggable_tag c ON (t.id = c.tag_id) LEFT JOIN image i ON i.id = c.id WHERE t.id IN (SELECT doctrine_s...