doctrine

How can I go about translating Doctrines YAML models into json-schema

Basically I am looking to be able to reuse model definitions to target both Doctrine models and JSON-Schema. I don't care if it means defining it in a 3rd model language and having the ability to convert that to both yml and json-schema or if it is from json-schema -> yml as long as I have 1 place to update both of them. ...

PHP-Doctrine2: Items - Shops - ItemsAtShops - how to conveniently implement using Doctrine2?

Hello. Somehow I can't figure out how to implement the following relations using Doctrine 2 syntax: I have Items and Shops. Each item has different price and different quantity at each shop. So, I have Items table, Shops table and ItemsAtShops table. How do I reflect the last one in Doctrine? I guess I need to create ItemsAtShops enti...

how to search multiple tags in doctrine

I have a database with many-to-many relations on tag and person. I am in trouble when tried to search a person with multiple tags. I tried this but its fail: $person = Doctrine_Query::create() ->from("Model_Person p") ->innerJoin("p.tags t") ->whereIn('t.id',$t) ->execute(); The above statement ...

Is it possible to add WHERE clauses when retrieving relationships?

In doctrine, is it possible to add a WHERE clause when fetching a property of an object that corresponds to a relationship? In terms of concept, let's say I want to retrieve only the first 3 blog posts made in the last 5 days. My "blog" object has a "posts" property which is defined as a relationship. Update... As some people are hav...

How to use Stored Procedures with Symfony and Doctrine

Hello I having problems at trying to call a MySQL Stored Procedure with Symfony 1.4 and Doctrine 1.2. What I want to do is the following: In a module/new after typing all the data in the form, I want to insert one of the values in another table. I don't know if this can be done with Doctrine without using a stored procedure. Thank...

PHP doctrine 1.2 ORM - polymorphic queries with class table inheritance

I'm experimenting with the Doctrine ORM (v1.2) for PHP. I have defined a class "liquor", with two child classes "gin" and "whiskey". I am using concrete inheritance (class table inheritance in most literature) to map the classes to three seperate database tables. I am attempting to execute the following: $liquor_table = Doctrine_Core::...

Issues with Doctrine Versionable (Audit Log) Behavior

Hi, Im using the Doctrine versionable behavior for one of my models. The schema works fine & tables are created. But when I try to load fixtures for this, I get a fatal error saying class TaxCodeVersion not found. I checked my Model dir, and indeed the class TaxCodeVersion is not generated by Doctrine. I always use the build --all --no-c...

Which problems can delimiting DB identifiers cause?

Hi. I've just found the following in the Doctrine manual: Just because you CAN use delimited identifiers, it doesn't mean you SHOULD use them. In general, they end up causing way more problems than they solve. Anyway, it may be necessary when you have a reserved word as a field name (in this case, we suggest you to chan...

Execution of subquery within table class gives class not found [doctrine]

Hi there! In table class Ouders I do the following query: $q = $this->createQuery('o') ->where('o.ouderid IN (SELECT DISTINCT k.parentid FROM Kinderen k WHERE k.schoolid = ?)', $schoolcode) ->orderBy('o.achternaam'); As you can see it has a subquery to the table class Kinderen. Why does it give the error?: An error occurred...

How to delete CodeIgniter db class?

Hi. I've started a CI project and I'm going to use it with Doctrine, there is benchmarking system for the latter and I'd like to remove the ability to use native CodeIgniter DB class, since it won't be benchmarked. I though about simply removing the corresponding files, but I'm afraid it could cause CI errors in other places. How can I r...

Symfony: question about the form filters

In the frontend I have a page with a list and a form filter next to it that shows all the users of a social network. I would like to hide the user of the session in that list. How can I do it? My first thought is creating a function, addXXXXColumnQuery(), for each field of the form, and in each one add a line like this: ->andWhere("u....

Doctrine: Change date format when getting and setting field values

Hello: I want to be able to get and set the date using my own date format (dd/mm/yyyy) and not doctrine (yyyy-mm-dd). I've found a way that is specifying a getter and setter for every date field however I want do it in a more convenient way (1 setter + 1 getter for every date field in every table is a lot) class Curs extends BaseCurs {...

[Doctrine 1.2.2] Check for table existence before dropping?

I'm trying to check for the existence of a table before dropping it. I've read through the API documentation for Doctrine_Table and I can't seem to find anything like this. Is there something I'm missing? I've got code that looks like: $table = new Doctrine_Table('model_name', $conn); $export = new Doctrine_Export(); $export->dropTab...

Doctrine adding a many-to-many relation for transient records

two models Site and Language share a many-to-many relationship (they are bi-directional) How do I add a relationship between them? Ideally I want to do this : (add an existing language to a new Site) $site = new Site(); $site->name = "Google" $site->url = "www.google.com"; ---- code to add language---- $site->save(); Or should I onl...

Doctrine cascade:[delete] does not call delete() method of related objects

I am using Doctrine 1.2 in my project. The schema.yml file contains: Campaign: tableName: campaign actAs: Timestampable: created: name: created_datetime type: timestamp format: Y-m-d H:i:s updated: disabled: true columns: id: type: integer(9) fixed: false unsign...

how to connect to another db with doctrine on zend framework

I use Zend Framework 1.10 with integration on Doctrine 1.2. in the application.ini file, i declare the 'dsn' to connect to database. in my application i need to connect to another db to run some queries. how can i do it ? i only need to run query , i don't want to generate all the Models for this DB. right now in the bootstrap.php...

How do you override your team's default databases.yml in Doctrine for using your local settings?

Looking for a way to cleanly override the values of databases.yml in Doctrine / Symfony in order to use my own local settings? The idea is not touching databases.yml and using some sort of local unversioned file to override that default. I'm trying to find out how without much success yet :/ ...

Using Doctrine 2 with Zend Framework 1.10.x

how can i get started with Doctrine 2 + ZF? any tutorials or resources? on a side note, i hear ZF2 will use Doctrine as its models, true? ...

ORM in Django vs. PHP Doctrine

I am a PHP guy. In PHP I mainly use Doctrine ORM to deal with database issues. I am considering move to Python + Django recently. I know Python but don't have experience with Django. Can anyone who has good knowledge of both Doctrine and ORM in Django give me a comparison of features of these two ORM implementations? ...

Doctrine - getChildren() with conditions?

Hi, I'm trying to write a basic plugin for the Symfony based CMS Diem. I'm trying to list of the child pages for the current page, which I have managed to do: $page = $this->getPage(); $this->subpages = $page->getNode()->getChildren(); However, I'm unsure of the syntax to use in order to filter the child records with conditions. I ...