doctrine

Doctrine 2 join troubles

Hi, I try to do this query using doctrine query builder $idAccount = $params['idAccount']; $qb = $this->_em->createQueryBuilder()->select('t,tt') ->from($this->_entityName, 'sr') ->innerJoin('sr.account', 'a') ->innerJoin('sr.product', 'p') ->leftJoin('p.title', 't') ...

Doctrine 2 preUpdate event - not triggered on insert?

I have a bunch of entities with both a date_created and date_modified field, and I'm attempting to have these fields automatically set themselves on insert or update. date_created is only set at insert, but date_modified is set at both insert or update. I have a method in my entity class with a @PreUpdate annotation, but it only seems t...

Doctrine YAML generates Datetime instead of Timestamp

Category: columns: id: type: integer(11) primary: true autoincrement: true unsigned: true name: type: string(255) notnull: true actAs: Timestampable: created: name: created_at type: timestamp format: Y-m-d H:i:s updated: name: updated_at type: timestamp for...

How do I set a MysQL variable (time_zone) from within doctrine / symfony?

I would like to know how I can set the MySQL time zone to UTC (SET time_zone = 'UTC') from within Symfony/Doctrine, so when I call a UNIX_TIMESTAMP() function on a DATETIME field in my query, it returns the UTC unix time and not unix time in the server's time zone. How can I do this, either automatically upon every connection, or manua...

Doctrine: How can I reference an attribute of a model with arrow ('->') notation?

According to the Doctrine manual I should be able to reference an attribute of a model using either arrow notation ($record->myField) or array notation ($record['myField']) as long as the model is derived from the Record class. I used Doctrine to generate my models from my database, so I have a (generated) Recipe class which extends a B...

Doctrine Schema changes to id auto-increment

I'm using YAML to define the doctrine schema and would like to start the id field that's set on auto-increment with a number other than 0, let's say 324 (this is done in mysql by doing something like AUTO_INCREMENT=324. This Google groups thread has a hint that it may be possible to do with command.pre_command event to execute the SQL b...

doctrin foreign keys

hello , i get table - $data = Doctrin ::getTable('product_catalog')->findAll();. this table (product_catalog) i link table. have 2 couloms with foreign keys. how i can check on $data have relation? thanks ...

Symfony : How to use permission / groups with sfGuardAuth

Hello, I just saw that there is no so much documentation about sfGuardAuth groups and permission. I have a permission named : moderator I have 3 groups : full_time / half_time / quarter_time In my backend (symfony 1.4 / doctrine), I have 5 modules Only these two have to be visible for this : [st_job / st_offers ...]. Generic rule : I...

How do I find out which version of Doctrine I am running?

The title says it all really. Have been using it for a while with CodeIgniter and I can't remember if I installed v2 or just copied the files from another project. Any ideas? ...

Where is my memory leak in this Doctrine 1.2 code?

I am trying to reduce my memory usage on a large loop script so I made this little test. Using Doctrine I run this code: $new_user_entry = getById($new_user_entries[0]['id']); unset($new_user_entry); $new_user_entry = getById($new_user_entries[1]['id']); unset($new_user_entry); function getById($holding_id) { return Doctrine_Core:...

PHP Doctrine - Best practice to set application-wide default table charset

At the moment, I am setting my table charset and collation like this: class Model extends Doctrine_Record { public function setTableDefinition() { //... $this->option('collate', 'utf8_unicode_ci'); $this->option('charset', 'utf8'); } } I am setting this in all my table definitions. Is there a way to set a default ...

Strange DOMPDF issue with Codeigniter

Hello, Just a quickie. I have tested DOMPDF in a Doctrine enabled Codeigniter 1.7.2 installation and everything works fine. However, when the Cart library and URL Helper are autoloaded as well, DOMPDF doesn't work. BUT, if you 'un-autoload' (ie. dont use) any one of Doctrine, the URL Helper or the Cart Library, DOMPDF works. Is ju...

Doctrine fixtures - circular references

Is there any way to load fixtures that have circular referencing? As an example I have the following fixture: BusinessEntityTeam: Nicole_Team: name: Nicole's Team Manager: [Nicole] Business: [ACMEWidgets] sfGuardUser Nicole: first_name: Nicole last_name: Jones email_address: [email protected] ...

How can I test dql code without FROM clause?

Hello, I want to test whether DQL supports this syntax : ROUND(NOW(), 'YEAR') (MySQL does). Here is what I tried in MySQL console: mysql> SELECT ROUND(NOW(), 'YEAR'); +----------------------+ | ROUND(NOW(), 'YEAR') | +----------------------+ | 20100923135639 | +----------------------+ Trying the same thing in DQL gives this: te...

[SOLVED] Are input->post arrays possible in codeigniter? I'm using doctrine and need to combine my birthday dropdown for db insert

I have just finished creating my signup form and now ready to insert data into the datebase using doctrine. Everything inserts fine but in my var_dump my birthday dropdown is in 3 seperates... day , month and year.. I would like to combine them and post as "birthday" into the db with doctrine. I wish to do this in my controller, please ...

Doctrine symfony multiple leftjoin Query

I am trying to run this query and getting error "Unknown relation alias programs". this is the query. $q= Doctrine_Query::create() ->select('students.firstname', 'students.middlename', 'students.lastname', 'programs.program', 'courses.ti...

How to change time part of a datetime value with doctrine?

I need to change the time part of a datetime in a database. What I got is in the database: '2010-01-01 01:00:00' I need to update this to '2010-01-01 03:00:00' Only thing I have is '03:00:00' As I'm using doctrine I could iterate through all objects but this would decrease the perfomance. So what I tried was: $q = Doctrine_Query::crea...

symfony doctrine query result and execute function

I have this doctrine query in symfony. It returns a lot of rows when i run mysql code generated by this dql query in phpBB but when i run it in symfony and access its results with this code: foreach ($this->courses as $course){ echo "<br>".$course->firstname;} it returns only one name. Also when i try to get $course->title, this erro...

doctrine Command Line Interface doesn't work

I followed all the instructions on this page : http://www.doctrine-project.org/projects/orm/1.2/docs/cookbook/code-igniter-and-doctrine/en i did all things but the Command Line Interface doesn't work for me when i execute the doctrine shell script in terminal it show me this define('BASEPATH','.'); // mockup that this app was execute...

Doctrine 1.2 - Many-to-Many with extra fields

Hi, I have defined four MySQL tables: accounts games games_to_accounts status A typical many-to-many relationship involving accounts, games, and games_to_accounts is in place. However the games_to_accounts table has an extra field, status_id, which defines how the associated account is treating the game (playing, for sale, etc). I c...