Questions tagged [propel]

Propel is an open-source object-relational mapping (ORM) for PHP 5. It allows you to access your database using a set of objects, providing a simple API for storing and retrieving data. There are two major versions, 1 and 2.

Propel is an open-source object-relational mapping (ORM) for PHP 5.

It allows you to access the records in your database using a set of OOP objects, providing a simple API for basic CRUD operations. To accomplish this, Propel ORM includes a generator component which uses source code generation to build PHP classes based on a data model definition written in XML (or reverse-engineered from an existing database).

Propel also includes a runtime component which manages connections, transactions, and any idiosyncratic rules that describe the workings of the RDBMS being used with Propel.

In addition to being open source, the code as implemented in a project is extendable with behaviors which alter the generated class structure and by working with the one-time generated model classes themselves which extend the base Active Record classes.

It is also an integral part of the PHP framework Symfony and was the default ORM up to and including version 1.2.


Documentation:

1161 questions
4
votes
1 answer

Propel ORM self referencing foreign keys

Im using Propel ORM and very new to Propel. I need some help selecting data from a table with a query I cant get right. Ive got a table like this (note: not actual table but same principal): +---------------------+ | ID | Page | Parent…
azzy81
  • 2,261
  • 2
  • 26
  • 37
4
votes
0 answers

Symfony2 Forms - Selected Value in Dropdown using Propel ModelType

I'm trying to set the selected value of a 'model' (ModelType from the Symfony Propel Bridge) form type and I'm failing miserably. There is Product table with the following structure: id, name, category_id Example data would be: id => 1, name =>…
4
votes
2 answers

PHP Database writing performance PDO VS ORM

We need to insert records in mysql quite fast for the purpose of syncing it with an other database. Which performs faster inserts. PHP PDO or some ORM (propel/doctrine)
user1551373
  • 131
  • 1
  • 3
  • 5
4
votes
1 answer

What are the rules of when propel's toArray() function will return referenced objects or just the top level?

I can't seem to nail the exact rule of thumb as to what is added to an array when using toArray(), insomuch that if I was to do something like this: $sheep = SheepQuery::create()->find(); foreach ($sheep as $sheepii) { …
LeonardChallis
  • 7,759
  • 6
  • 45
  • 76
4
votes
2 answers

Symfony/Propel 1.4: Read from one, write to other DB

We have an existing project (SNS website+android/Iphone games) in Symfony 1.4/ Propel 1.4 We are experiencing extra load on DB server (say DB1). We are doing DB Optimization but as immediate solution we decided to create one more DB server in the…
Kapil Sharma
  • 10,135
  • 8
  • 37
  • 66
4
votes
3 answers

symfony 1.4 propel 1.6 : sum

I'm trying to get a sum of columns in propel. My code $c = new Criteria(); $c->add(valuePeer::OWNER_ID, $this->getId()); $c->addSelectColumn('SUM(' . valuePeer::VALUE . ') as total'); $c->addGroupByColumn(valuePeer::VALUE); $sum =…
Kuro
  • 878
  • 9
  • 28
4
votes
0 answers

Error after Upgrading FOS UserBundle from 1.2 to 2.0 in Symfony 2.1

I have a project in Symfony 2.1, with PropelBundle, and FOS UserBundle. I upgraded FOS UserBundle with Composer from 1.2 to the latest version (2.0) and followed the instruction to delete the "propel_user_class" definition in the…
RayOnAir
  • 2,038
  • 2
  • 22
  • 33
4
votes
1 answer

Propel filtering based on joined tables columns?

How do I filter based on a joined table's columns in Propel? Like: $results = FooQuery::create()->joinBar()->filterByBarSurname('surname');
Tower
  • 98,741
  • 129
  • 357
  • 507
3
votes
1 answer

PropelORM, Symfony 2 and Unit testing

I'm used to the habit of writing like this: $results = SomeModelQuery::create()->filterByFoo('bar')->find(); However this does not scale for unit testing because I can't inject a mock object, i.e. I can't affect what data is returned. I'd like to…
Tower
  • 98,741
  • 129
  • 357
  • 507
3
votes
1 answer

Symfony Multiple Post Validators

I'm using Symfony 1.4 and having an issue using multiple form validators. For part of the form, I need to make sure the email address is valid AND unique. Here's the code I'm trying to use this: $this->validatorSchema['email_address'] = new…
Eric
  • 2,201
  • 5
  • 29
  • 35
3
votes
2 answers

Concurrency Problem

I'm having what seems to be a concurrency problem while using MySQL and PHP + Propel 1.3. Below is a small example of the "save" method of a Propel object. public function save(PropelPDO $con = null) { $con = Propel::getConnection(); try { …
Ree
  • 6,061
  • 11
  • 48
  • 50
3
votes
3 answers

How can I write a SQL count with group by clause using Propel ORM in Symfony?

How can I write the following SQL query using the Propel ORM? SELECT species, COUNT(*) FROM Bird GROUP BY species;
Justin
  • 4,203
  • 7
  • 41
  • 58
3
votes
3 answers

Instantiate PHP object with string via factory

This is similar to Can PHP instantiate an object from the name of the class as a string?. I'm using propel orm with PHP 5.2.17, and I want to store the name of a query class in the database, say "AuthorQuery", then use it to get a query object. …
Joe Flynn
  • 6,908
  • 6
  • 31
  • 44
3
votes
2 answers

Forms in Symfony2 with Propel?

I can't seem to find any documentation on Symfony2 forms when using Propel ORM. Is this even supported? When I run the console API it lists all propel commands and none of them was propel:build-forms. Does this mean Propel ORM for Symfony2 does not…
Tower
  • 98,741
  • 129
  • 357
  • 507
3
votes
1 answer

Propel case-sensitive phpNames for columns

The relevant portion of my schema.xml:
Andrew
  • 14,325
  • 4
  • 43
  • 64