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

388 questions
4
votes
1 answer

Manually writing DQL

I am trying this part in the Doctrine Documentation wherein you can: Manually writing DQL For you SQL buffs, we didn't forget about you. You can optionally write your DQL queries manually and parse them in to a Doctrine_Query instance or just…
user123
  • 1,060
  • 3
  • 13
  • 29
4
votes
3 answers

Aggregate values in Doctrine_RawSql queries

Is it possible to use aggregate values in Doctrine_RawSql query? Here's what I'm trying to do: $q = new Doctrine_RawSql(); $q->select('{q.*}, AVG(a.value) AS avg'); $q->from('-- complex from clause'); $q->addComponent('q', 'Question'); However, SQL…
Jan Dudek
  • 807
  • 1
  • 9
  • 17
4
votes
1 answer

Creating tables using Doctrine in Symfony

After I had created a "motor" DB in MySQL, I configured the DB in Symfony with this command: $ php symfony configure:database "mysql:host=localhost;dbname=motor" root Under appname/config/doctrine/ I have a schema.yml file. In this…
rfc1484
  • 9,441
  • 16
  • 72
  • 123
4
votes
1 answer

Doctrine pain while accessing members of a left join that are null

I have a Doctrine query in my model say Model_1Table.class.php that left joins with Model_2. Model_2 relates to Model_1 on a many-to-one relation. (it really is a one-to-one relation and not a many-to-one but the schema got designed so) My query…
user1020069
  • 1,540
  • 7
  • 24
  • 41
3
votes
1 answer

Doctrine Query with *

I do have table called zipcodes. The length of a zipcode is five. How can I create a query in Doctrine that I get the result, when I only submit 3 characters to the query. Example: $search_zipcode = 123* Table: Id Zipcode 1 - 12345 2 - 12346 3 -…
craphunter
  • 961
  • 2
  • 13
  • 34
3
votes
1 answer

How to not load the same reference twice in doctrine

Let say that we have two tables: Post and Category and two posts that have the same category_id, let say 1. $post1->getCategory()->getName() will load the category that has category_id 1 $post2->getCategory()->getName() will do the same query to…
Alin
  • 267
  • 4
  • 15
3
votes
2 answers

Doctrine Query calculate MAX value in WHERE clause

I have this tables: subscribers id | name | ---+-------+ 1 | Hill | 2 | Sam | 3 | Joe | subscribers_years subscriber_id | year | --------------+-------+ 1 | 2009 | 1 | 2010 | 1 | 2011 | 2 …
JellyBelly
  • 2,451
  • 2
  • 21
  • 41
3
votes
1 answer

Doctrine Record Listener never fired

I'm trying to create one record listener for all models. In ProjectConfiguration.class.php I added: public function configureDoctrineConnection(Doctrine_Connection $connection) { $connection->addRecordListener(new doctrineLogger()); } And…
Pavel Linkesch
  • 3,546
  • 3
  • 22
  • 23
3
votes
1 answer

Conditional IF statement in a PHP Doctrine 1.2 SET statement

I would like find the correct syntax for the SET line: Doctrine_Query::create() ->update('Media m') ->set('m.fallback IF(m.id = ?, 1, 0)', $id) <-- not correct ->execute(); Thanks for any help!
cyberwombat
  • 38,105
  • 35
  • 175
  • 251
3
votes
2 answers

Doctrine query : confusing addWhere, andWhere, orWhere

I have a query : $q->andWhere($q->getRootAlias().'.is_published = ?', 1); $q->andWhere($q->getRootAlias().'.published_at >= ?', time()); $q->leftJoin($q->getRootAlias().'.EventLdapGroup l'); $q->andWhereIn('l.ldap_group_id', $permissions_id…
sf_tristanb
  • 8,725
  • 17
  • 74
  • 118
3
votes
3 answers

How to get the following array from database?

Ok to make it more clear: I am Using doctrine I have a table Brands and Products Brand id name Product id name brand_id I have a lot of brands and Products of those brands in the database. I would like to retrieve List of brands(+ count…
simple
  • 1,091
  • 4
  • 14
  • 32
3
votes
3 answers

Symfony sfDoctrineGuardPlugin custom login query

I use symfony sfDoctrineGuardPlugin to manage authentication for both frontend users and backend users. It's fine, except that I don't want frontend users to be able to login to the backend app. I can setup credentials, but credentials are checked…
Dziamid
  • 11,225
  • 12
  • 69
  • 104
3
votes
2 answers

Doctrine and SQL Injection

Does Doctrine automatically prevent SQL injection? Is the following code secure? $user = new Model_User(); $user->name = $_POST['username']; $user->save();
peter
  • 71
  • 1
  • 5
3
votes
3 answers

doctrine select statement always returns all fields of the table

I have the following table Test: tableName: test columns: test_id: name: test_id as id primary: true autoincrement: true type: integer notnull: true test_name: …
Martin
  • 61
  • 1
  • 5
3
votes
1 answer

doctrine 1.2 how to get an object by id?

How can i get an object using his Id in doctrine 1.2 ? Without writing sql or Dql. I did not find it in the docs: https://doctrine.readthedocs.org/en/latest/en/manual/working-with-models.html#fetching-objects
maazza
  • 7,016
  • 15
  • 63
  • 96
1 2
3
25 26