doctrine

Doctrine: Set field value to SQL expression

I need to set value in mapped record to some arbitrary sql expression, so on obj.save() it would be used directly, w/out escaping/quoting. Something like this: obj.location = "Point($x, $y)"; obj.save(); Which should result in query like UPDATE ... SET location = Point(..., ...) WHERE ...; However I cannot find anything like this i...

Symfony schema works on my local server, but gives foreign_key constraint issues moving to Dreamhost

I'm using symfony 1.4 and doctrine. I've spent the last couple days playing with my schema, and I've gotten it to load up / build / behave properly but only on my local machine. When I copy the files to an account on Dreamhost, change the configuration to allow a connection to that database (and nothing else) I get the following error tr...

Doctrine 2 PlainValue expected

I'm having trouble executing a Doctrine DQL Query. This is the error it gives me. Doctrine\Common\Annotations\AnnotationException: [Syntax Error] Expected PlainValue, got 'integer' at position 13 in property Base\Session::$lifetime. My code looks like this: $query = $em->createQuery("SELECT s FROM Base\Session s WHERE s.session = \"...

Doctrine: Bind IN parameters

I was wondering if it is possible to bind an array of integers as a parameter, so I could do something like this? $q = Doctrine_Query::create() ->update('blah c') ->set('ignored', true) ->where('id in ?', array(1,2,3,4)); I guess that this isn't possible because it actually b...

why do i get a constraint error?

hi, i'm using symfony 1.4, and my schema is as follows: Auditor: columns: id: type: integer autoincrement: true primary: true username: type: string(255) password: type: string(255) fullname: type: string(255) is_auditor: type: integer is_manager: type: integer ...

How to get rows count from table in doctrine

I have wrote universal script to get all rows from Doctrine Table Models, but if rows amount is too large, i get exception: Cannot define NULL as part of query when defining 'offset'. Running script: $table = new JV_Model_StoreOrder(); $this->data['list'] = $table->getTable()->findAll()->toArray(); I understand from the error above...

Zend Framework, Doctrine and Caching Problems

I'm using Doctrine 1.2 with Zend Framework, and it's working just fine. Now I want to start using the results cache and query caching capabilities to reduce the load on DB server that powers the application. Oh, I'm also using Zend_Application and placing code in modules. Anyway, I setup my connections to Doctrine in the overall Boots...

Why will Doctrine ORM will not create SQL query for my 1-to-many model??

I know this has to have an easy answer, but I cannot figure it out. After tears, I am hoping someone here can help. Here is my YML model: Identity: columns: id: type: integer(10) primary: true autoincrement: true username: type: string(255) Profile: columns: id: ...

Get the last insert id with doctrine 2?

How can I get the last insert id with doctrine 2 ORM? I didn't find this in the documentation of doctrine, is this even possible? ...

Why do Doctrine model classes generated starting with 'A', 'B' cause a crash, but those starting with 'X' or 'Z' do not.

I'm using Doctrine together with CodeIgniter. I have can't quite figure out the logic of why the generated models from my YaML starting in 'A' crash. For example generating a model from the following YaML will work fine: Pguy: columns: ptext: string(255) Likewise: Zguy: columns: ztext: string(255) will produce models/...

Doctrine: How to combine 3 of the table, with the attitude of many to many

There are 3 tables: catalog product product2catalog Table product2catalog consists of the following fields: catalog_id product_id How to get goods within the directory? How to rebuild the connection to be able to do so: $CatalogTable = CatalogTable::getInstance(); $Catalog = $CatalogTable->find( $id ); var_dump( $Catalog->product ...

Unit testing with Zend Framework/Doctrine 2.0

I wanted to write unit tests for my Zend Framework/Doctrine 2.0 application, but I don't quite understand how to set up unit testing in ZF. Also, I would like to include Doctrine 2.0 in those unit tests. How would I go about setting this up? Can you point me to an example? Thank You ...

ZF, ZFDoctrine and PHPUnit setup

Hi, Does anyone here use Zend Framework, ZFDoctrine and PHPUnit together? How to rebuild the database on each test run? How to separate local/production/testing environments? Would you share your unit testing setup? I have been trying something like that: // /tests/bootstrap.php // ... setup paths and constants here require_once 'Ze...

Using Doctrine with views - dud 'id' field generated

I have a DB (yes, that one) which is proving far easier to access via views than raw tables. In general this plays quite nicely with Doctrine, but there's one issue. Doctrine can't identify a primary key in a view table when generating the YAML from the database schema, so it invents one called 'id'. Generating classes from this means th...

PHP: Choosing ORM for future expansion and changes?

Hi everybody, I come from a Codeigniter MVC background that we've been working with for some time now. It's time to roll our own framework for a big project, but we have come now to the Database part and got a bit confused immediately. In Codeigniter, we've used the ActiveRecord for all SQL database connections, which has worked well, b...

Can I only generate base classes when calling Doctrine::generateModelsFromYaml()?

I am using Doctrine::generateModelsFromYaml(). It creates a directory filled with base classes. Cool. I'm guessing the point of separating the base classes is to store only column definitions and relationships (in other words, only things that can be gleamed from the DB. The extension models, on the other hand, will be edited with behavi...

When using Doctrine::generateYamlFromDb(), can I specify a prefix to use?

When using Doctrine::generateYamlFromDb(), can I specify a prefix to use? For example, if the table name is "user", by default, the generated class name would be "User". Can I make sure the class name (and filename) is "PrefixUser"? ...

Trying to generate tables from Doctrine models and getting MySQL errors

Doctrine_Core::createTablesFromModels() is failing with the following error: Fatal error: Uncaught exception 'Doctrine_Connection_Mysql_Exception' with message 'SQLSTATE[42S02]: Base table or view not found: 1146 Table 'newmexicocreates.address_type' doesn't exist. Failing Query: "SELECT a.id AS a__id, a.title AS a__title FROM address_...

Doctrine2: Best way to handle many-to-many with extra columns in reference table

I'm wondering what's the best, the cleanest and the most simply way to work with many-to-many relations in Doctrine2. Let's assume that we've got an album like Master of Puppets by Metallica with several tracks. But please note the fact that one track might appears in more that just one album like Battery by Metallica does - three albu...

Symfony 1.4: doctine i18n problem

Hi Volks, I have a weird problem with my i18n doctrine schema and i.a. the admin generator. (Please look at the edit part below first) The schema looks like: CargoSize: connection: doctrine actAs: Timestampable: ~ I18n: fields: [name, linkname, seoname, description] tableName: com_cargo_size...