doctrine

Setting Doctrine attributes in a task

I'm trying to set a Doctrine attribute in a task, but it doesn't seem to work. What I'm trying to set, is an attribute to disable Doctrine validation: $databaseManager = new sfDatabaseManager($this->configuration); $connection = $databaseManager->getDatabase('doctrine')->getConnection(); $connection->setAttribute(Doctrine_Core::ATTR_VA...

Sql: Unique field contraint (slug) across multiple tables (doctrine/symfony)

I have a number of tables that will be looked up using the url 'slug'. For example 'news' and 'blog' both have the 'slug' field, which is defined as a unique field in the doctrine database schema. Is there any way I can extend this uniqueness across both tables: for example if there is a news article with slug= "good-story" then it will...

Couldn't locate driver named sqlite

symfony 1.2, doctrine, dsn: sqlite:%sf_data_dir%/db.sq3 When i am trying "php symfony dctrine:build-sql" i get this error, but on frontend all fine. Also i have tried to change ini file this way php -c "path to file" symfony doctrine:build-sql but get the same error Couldn't locate driver named sqlite ...

MN relationships in Doctrine

ZF has a very nice feature which is called findManyToManyRowset which returns you directly a collection of objects from a MN connection. The whole purpose of MN is to get the information from the other table, not from the connection table. We have this schema: - users - id - name - groups - id - name - user_has_groups - use...

how to define an autoincrement id column in doctrine?

I'm using symfony 1.4 with doctrine as my ORM, I need to do one of two thing to get it working, and I don't know how to do it. If anyone can help me please do :-P the id fields should not be bigint, just int or When I define my table as follows: Table: columns: id: type: integer autoincrement: true primary: true make th...

Unknown record property / related component "..." on "..." with sfDoctrineActAsTaggablePlugin

Hi, I'm using the symfony plugin sfDoctrineActAsTaggablePlugin to add a Taggable behaviour to some objects of my model. I followed the instruction given here but when I want to save a taggable element in the database I get : Unknown record property / related component "saved_tags" on "Mishidea" Mishidea is the name of the class/tabl...

DQL Update with relations

Following Models: class User extends Doctrine_Record { public function setTableDefinition() { $this->hasColumn ( 'iron', 'integer', 4 ); } public function setUp() { $this->hasMany ('Field as Fields', array( 'local' => 'id', 'foreign' => 'owner_id' )); } } class Field exte...

Symfony plugin sfDoctrineActAsTaggablePlugin not working

Hi, I want to attribute some tags to some of the objects of my doctrine model. I found sfDoctrineActAsTaggablePlugin which seems to be precisely what I need. The problem is that when I want to save a Taggable object, I get this error: Unknown record property / related component "saved_tags" on "Mishidea" Mishidea is the name of the...

[symfony] Problem with two Doctrine request

Hello, Hello I have a little problem with requests : In an action executeFiche, I have three requests public function executeFiche(sfWebRequest $request){ // Récupération du logement correspondant à l'ID passé dans l'URL $this->forward404Unless($this->logement = Doctrine::getTable('Logement')->find(array($request->getParameter('...

What is the syntax to set the auto increment start value in schema.yml with Doctrine?

The title says it all. I want to set the start value for auto increment on a column to 1000000 (to avoid conflicts with a legacy application), but can't find any documentation that tells me how. Pretty standard table, here's what the relevant bit looks like: User: attributes: export: tables columns: id: type: inte...

Doctrine and aliases from the select clause in the where clause.

I am using an alias in my select clause ("AVG(u.rating) as avg_rating") and would then like to add this in my where clause "avg_rating > 3" but when I try and run this query I get a "Unknown column 'u3__1' in 'where clause'." Does anyone happen to know how I can get my where clause to see the alias? This alias works in the orderBy with ...

Update object instead of inserting with Doctrine using assignIdentifier()

I'm pretty new to Doctrine, but as I understand it, the assignIdentifier() method is supposed to tell Doctrine to update the relevant row into the database instead of inserting a new one. I have an object that I'm building through a workflow, so the identifier has an id of null until I call $object->save(); which inserts it, and this do...

how can I define a value for model's field in symfony?

I'm building an app for the company I work for in symfony, non the less the app might be pretty useful outside our company so we decided to write it in a more general form so we can make it multi company. I'm facing a problem on how to define a default value for a field that is going to be in every single model (company_id) so we don't ...

Retrieveing the Query that Created a Doctrine_Collection

I have a Doctrine_Collection object that was created with code that looks something like. $collection = Doctrine_Query::create() ->from('FooBazBar') ->where('widget_id = ?',$some_var) ->execute(); Short of writing it down somewhere, is it possible to to retrieve the where clause that was used to create the collection? That is, I want...

Doctrine yaml for a One-To-Many And One-To-One Relationship

I have two objects: File and FileDetail. A File can have many FileDetails, but a FileDetail can only have one File. I can get this to work, but I can't delete anything from the database because of key constraints (I can't delete the File row because FileDetail depends on it, and vice versa). I have the following yaml: File: columns: ...

How to merge two doctrine entities in the same object

Hi, In my database, the user management is divided into two tables: - One created by the symfony sfDoctrineGuard plugin (sfGuardUser), with the username, the password and other information used by the plugin - another one that I created to extend this table with more properties such as the firstname, surname etc... What I want to do is...

Singleton Models Doctrine

Can we have a model class which is singleton in Doctrine? For Singleton classes I should have a private/protected constructor....but this is not possible as I am extending a Doctrine class which has a public constructor You can argue about the use of the Singleton pattern when interacting with the DB, but just consider this scenario: ...

Facultative relation with Doctrine ORM

How should be implemented facultative one-to-one relation in Doctrine ORM and Symfony? Suppose there are some folders represented in database. Each folder can have a default icon or some custom icon represented in another table. How should this relation be described in the schema file? How can I tell that in case of given folder relation...

Using a different Connection within Doctrine_Table in symfony 1.4 / sfMasterSlavePlugin

Hi all :) In my symfony project i'm working with doctrine for my data models. Also i have the sfMasterSlavePlugin installed to use different connections for different kinds of queries (writes vs. reads). Because of the small delay in mysql's replication my code is failing to fetch a freshly inserted record. To get around this problem i...

Jobeet Day 3, doctrine:data-load problem

I'm trying to load data from fixtures jobs.yaml and categories.yaml with this command: $ php symfony doctrine:data-load But the tables are empty. I have got the columns and tables created, but no data loaded. It returns: doctrine Loading data fixtures from "./jobeet/data/fixtures" doctrine Data was successfully loaded And the so...