We're using Doctrine, a PHP ORM. I am creating a query like this:
$q = Doctrine_Query::create()->select('id')->from('MyTable');
and then in the function I'm adding in various where clauses and things as appropriate, like this
$q->where('normalisedname = ? OR name = ?', array($string, $originalString));
Later on, before execute()-in...
I'm using Doctrine, a PHP ORM. I have created a Doctrine Query, and I need more control. So I've started to use the ->andWhere(...) methods to add new where clauses. However I need to do a subquery based on another table, like so:
$query->andWhere("id in (SELECT id from other_table where value = ?)", $myvar);
The above doesn't work. H...
I'm having problems with a batch insertion of objects into a database using symfony 1.4 and doctrine 1.2.
My model has a certain kind of object called "Sector", each of which has several objects of type "Cupo" (usually ranging from 50 up to 200000). These objects are pretty small; just a short identifier string and one or two integers. ...
Hello. I'm using Symfony with Doctrine.
I have two classes defined, Person and Student, a relation one to one.
Each Student is related to a Person, but not every Person has a relation with a Student.
When I call ...
$person->getStudent();
... I always get and object, regardless some Person's doesn't have a Student. How can I know ...
I had doctrine and ORM working very well together.
Then I removed three rows from my MySQL db and removed those values from my model. Now doctrine returns absolutely nothing. Not even a NULL value from the function or an error.
I'm wondering if doctrine caches my schema somewhere or if I'm missing something
...
i have a model called ContentGroup and another called Content with a many-to-many relation between them.
The intermediate table has a field called Position, When i try to write a DQL query to obtain all the contents associated with a ContentGroup i cannot reference the position field usign the aliases of the models or relations involved...
I have been researching a way to get the SQL statements that are built by a generated Migration file. These extend Doctrine_Migration_Base. Essentially I would like to save the SQL as change scripts.
The execution path leads me to Doctrine_Export which has methods that build the SQL statement and executes them. I have found no way of ...
Error Message:
The route "default" does not exist.
Yes, it doesn't exist. But as described in the Doctrine version of "Practical Symfony | Day 5" everything should work well when default routing is removed, because all actions of the job module has been successfully routed by other routers.
I get the error when I request the URL below...
I want to link a physical file with a row in a table. My intention is to use database habilities to delete the files that are referenced in the table. For example:
$o = Doctrine::getTable('Document')->find(12);
$o->delete();
This code delete the row in the table, i want to delete an hipotetical file referenced in $o->file_locatio...
I have a database design case which I am curios whether Doctrine ORM supports it out-of-box.
Product:
columns:
id: {type: integer, primary: true, autoincrement: true }
type_id: { type: integer, notnull: true }
brand_id: { type: integer, notnull: true }
relations:
ProductType:
class: ProductType
loc...
I'm trying to find related objects to one object by matching the objects tags. I've constructed a mysql query which will return the objects that match the most by counting the matching tags.
I'm new to doctrine (1.2) so I'm wondering if someone could help me to get on the right track modifying my schema and creating a DQL query? The bi...
Whats this??
my query is:
Doctrine_Query::create()
->select('rec.*')
->from('Records rec')
->execute();
Records table contains more than 20k rows.
On executing query on page i am getting an error:
Fatal error: Maximum execution time of 60 seconds exceeded in...
I am having a table in which there is a column in which various values are stored.i want to retrieve unique values from that table using dql.
Doctrine_Query::create()
->select('rec.school')
->from('Records rec')
->where("rec.city='$city' ") ...
Hi everybody,
I'm using Symfony 1.4 + Doctrine 1.1.
I have a schema with a one-to-many relation.
Let's say A has many B, I ask for all the B's of A as follow: $a->b
This returns a Doctrine_Collection.
What I want its a way to tell doctrine to give me all the B's of A sorted by a particular attribute of B.
I don't want to re-write th...
im using doctrine-project
and i have 3 tables
table 1: post
--------------
postid , title , date , some more fields....
table 2: tags
---------------
tagid , title
table3: post_tags
--------------------
post_tags_id , tagid , postid
table 3 is link between tags and posts which mean
each post get tags through post_tags
now in ba...
I have a problem with the toArray() method in Doctrine. Its doesn't get my relations:
First query :
$q = Doctrine::getTable('posts')->find(1);
debug($q->toArray(true));
Print the postid=1 with out the relations
$q = Doctrine::getTable('posts')->find(1);
$q->Tags->toArray();
debug($q->toArray(true));
...prints the results with tag ...
I'm trying to setup doctrine in my project and whenever I call on a class, e.g.
$dealer = Doctrine_Core::getTable( 'Dealers' ).find(1);
Then I get Fatal Error: Class BaseSchools not found.
I know those files exist, since I did Doctrine_Core::generateModelsFromDb and I can see them
Somehow my paths to my models/generated folder aren'...
I have this code that runs with every page load:
$output = "<"."?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?".">\n\n";
$output .= print_r($events, 1);
$output .= "\nTotal Doctrine time: " . $time . "\n";
$output .= "Peak Memory: " . memory_get_peak_usage() . "";
file_put_contents(BASEPATH."/logs/doctri...
Doctrine:
Doctrine is an object relational mapper (ORM) for PHP 5.2.3+ that sits on top of a powerful database abstraction layer (DBAL). One of its key features is the option to write database queries in a proprietary object oriented SQL dialect called Doctrine Query Language (DQL), inspired by Hibernates HQL.
ORM:
Object relational m...
Hi, I've come across something that seemed simple before but has me scratching my head again. I have a table for users:
user_id (PK) | username| email | something
... and a table for "views" for when one user has viewed another user:
view_id (PK) | viewer_id | viewed_id | view_date
The "viewer_id" and "viewed_id" are both user_ids,...