Questions tagged [doctrine-1.2]

Doctrine 1.2 is a PHP (5.2.3+) ORM. While Doctrine 2.0 uses the Data Mapper pattern, Doctrine 1.2 uses the Active Record pattern.

Doctrine 1.2 is a PHP (PHP 5.2.3+) ORM. While Doctrine 2.0 uses the Data Mapper pattern, Doctrine 2.0 uses the Active Record pattern. The Doctrine project is a collection open source libraries and tools for dealing with database abstraction and Object-Relational Mapping written in PHP.

Useful links

390 questions
24
votes
6 answers

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

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?
slugmandrew
  • 1,687
  • 2
  • 21
  • 42
23
votes
2 answers

How to query NOT NULL with Doctrine?

I have table Test: Test: id | name 1 | aaa 2 | 3 | ccc 4 | aaa 5 | 6 | ddd I want result where name is NOT NULL: aaa ccc aaa ddd How can i get with: Doctrine_Core::getTable('Test')->findBy('name', NOTNULL??) <-doesnt working and in model…
Michael Fidy
  • 269
  • 1
  • 3
  • 9
22
votes
4 answers

MYSQL incorrect DATETIME format

I have an app with Doctrine 1 and I generate update_datetime fields for objects via new Zend_Date->getIso(). It worked just fine for years, but now I got a new notebook and Doctrine tries to insert a DATETIME fields as a string…
firedev
  • 19,222
  • 18
  • 58
  • 91
15
votes
2 answers

How to escape LIKE %$var% with Doctrine?

I am making a Doctrine query and I have to do a wildcard match in the where clause. How should I escape the variable that I want to insert? The query I want to get: SELECT u.* FROM User as u WHERE name LIKE %var% The php code until now: $query…
Peter Smit
  • 24,538
  • 27
  • 105
  • 165
13
votes
5 answers

how to convert Doctrine object into json

I am using Doctrine 1.2, how could I get the query object into json / array format? $user = Doctrine_Query::create() ->select('u.id, u.username, u.firstname, u.lastname') ->from('User u') ->orderby('u.id') ->execute();
cc96ai
  • 621
  • 4
  • 14
  • 23
13
votes
4 answers

Iterate Doctrine Collection ordered by some field

I need something like this: $products = Products::getTable()->find(274); foreach ($products->Categories->orderBy('title') as $category) { echo "{$category->title}
"; } I know is it not possible,…
inakiabt
  • 1,891
  • 1
  • 16
  • 28
12
votes
2 answers

Select One column Doctrine DQL

I need a simple column for a table. By example a table "project", with column id, name and year. If I do: $q = Doctrine_Query::create() ->select('a.pro_id') ->from('fndr_proyecto a') ->where('a.pro_id =?',1); $pro =…
h3g0r_
  • 199
  • 1
  • 3
  • 13
10
votes
3 answers

Doctrine Documentation for 1.2

Anyone happen to know what happened to the Doctrine docs for 1.x? Going through their official documentation page (have to scrolldown to 1.2), and clicking any of the documentation links results in a 404. I have also noticed that several google…
Mike Purcell
  • 19,055
  • 9
  • 47
  • 84
10
votes
4 answers

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…
Casey
  • 1,686
  • 3
  • 19
  • 35
9
votes
3 answers

Default sort attribute for Doctrine Model

I was wondering if there is a way to declare the default order for my doctrine models. e.g. I have a work model and it has photos. When I load a work, all photos associated to it get loaded into $work->photos. When I display them, they are ordered…
Nacho
  • 7,544
  • 15
  • 57
  • 74
8
votes
2 answers

Preventing Doctrine's query cache in Symfony

In my Symfony/Doctrine app, I have a query that orders by RANDOM(). I call this same method several times, but it looks like the query's result is being cached. Here's my relevant code: $query = $table->createQuery('p') ->select('p.*, RANDOM()…
Matt Huggins
  • 73,807
  • 32
  • 140
  • 214
8
votes
2 answers

Doctrine 1.2 hydrate method - array to model object

I have a little problem with Doctrine model hydrate() method. I use this method to hydrate an object of conrete model from a given array like so: $model = new Doctrine\Model\Model; $model->hydrate($model_array); Everything works perfect when…
shadyyx
  • 15,095
  • 5
  • 48
  • 91
7
votes
2 answers

Doctrine 1.2 hydration fails with HYDRATION_RECORD, but works with HYDRATION_ARRAY

I have a code that runs perfectly with Doctrine_Core::HYDRATION_ARRAY, but crashes with Doctrine_Core::HYDRATION_RECORD. The page is loading for about two minutes and shows standard browser error message, which is something like Connection to the…
J0HN
  • 23,930
  • 5
  • 46
  • 83
7
votes
1 answer

Doctrine 1.2 how to compare dates

How can i set a condition, in a where clause of Doctrine 1.2 ORM to specify Greater than date in DQL example Doctrine_Query::create() ->from('user u') ->where(?) ->execute(); Thanks
Juan Jo
  • 853
  • 1
  • 8
  • 17
7
votes
2 answers

How to make an insert query in DQL

I'm working with symfony and I would like to know how I can do a simple insert using the doctrine:dql task. ./symfony doctrine:dql ""
greg0ire
  • 21,120
  • 15
  • 68
  • 95
1
2 3
25 26