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
5
votes
4 answers

Switch symfony 1.4 from Doctrine to Propel

How can I properly switch the newly installed Symfony 1.4 framework from Doctrine (that it is configured for by default) to Propel?
Stepashka
  • 2,648
  • 20
  • 23
5
votes
1 answer

Why does propel convert float property to string?

I just noticed, that propel converts numeric values to strings in generated setter methods. My problem with that is, since I am using german locale, float values are insert with a comma instead of a dot. For example: "3.5" results in a string "3,5".…
Leif
  • 1,076
  • 10
  • 16
5
votes
1 answer

Using the Propel ORM, how would one delete all related records of an object?

I have a pretty simple Propel question. I'm storing leads in a database. Those leads have one or more community interests. The tables I'm using are named, 'lead', 'community', and a 'lead_communities' join table. What's the best way to delete…
clone45
  • 8,952
  • 6
  • 35
  • 43
5
votes
1 answer

What's the most correct way around this propel "Cannot redeclare function" error?

I have the following tables: user, logbook, user_logbook User logbook is a junction table (isCrossRef="true" in the schema.xml), containing user_id and logbook_id foreign keys. I also wanted to remember the currently selected logbook for any given…
LeonardChallis
  • 7,759
  • 6
  • 45
  • 76
5
votes
2 answers

Clear propel cache (instance pool)

I need to force reread data from DB within one php execution, using propel. I already have a bit hacky solution: call init%modelName% for corresponding classes, but want something better. Is there any single call or service config option for that?…
kirilloid
  • 14,011
  • 6
  • 38
  • 52
5
votes
2 answers

Install propel using composer

I am trying to use propel with composer but I'm getting errors. My composer.json is: { "require": { "propel/propel" : "*" } } and the error is: Problem 1 - The requested package propel/propel * could not be found. Does anyone…
Adler Medrado 和尊
  • 2,108
  • 2
  • 15
  • 14
5
votes
2 answers

Is Propel's fromArray/fromJSON feature safe from SQL injection?

The Propel ORM documentation mentions a neat import/export feature using functions like fromArray and fromJSON, that should allow something like this: $foo = new Widget(); $foo->fromArray($_POST); $foo->save(); /* Aaand you're done! */ ...but the…
Wander Nauta
  • 18,832
  • 1
  • 45
  • 62
5
votes
1 answer

Propel, Add alias to select statement

I'm using propel master-dev with symfony 2.1. Is possible to write something like that ? Else how can I add an alias to the select statement. $products = ProdottinewQuery::create() ->leftJoinWith('Prodotticolori') …
originof
  • 795
  • 1
  • 7
  • 24
5
votes
3 answers

In symfony, how to set the value of a form field?

I'm overriding my doSave() method to basically do the following: I have a sfWidgetFormPropelChoice field that the user can either choose from, or type a new option. How can I change the widget's value? Or maybe I am approaching this the wrong way.…
James Skidmore
  • 49,340
  • 32
  • 108
  • 136
4
votes
2 answers

Propel and leftJoin

In Doctrine i can: $q = Doctrine_Query::create() ->from('One o') ->where('t.text = ?', 'aaa') ->andWhere('h.text = ?', 'bbb') ->leftJoin('o.Two t') ->leftJoin('t.Three h') ->leftJoin('h.Four f') …
Timothy Grees
  • 121
  • 2
  • 8
4
votes
2 answers

JavaScript: Backbone.js populate collection of models

Here is what I have so far: var Item = Backbone.Model.extend({ defaults: { id: 0, pid: 0, t: null, c: null }, idAttribute: 'RootNode_', // what should this be ??? url: 'page.php' }); var ItemList =…
Nahydrin
  • 13,197
  • 12
  • 59
  • 101
4
votes
1 answer

Using Sphinx Search with an ORM

I'm looking at implementing Sphinx search within our site. Rather than having to do strange things with including new libraries etc, it makes more sense to me to integrate it using SphinxQL, as this is fairly close to native SQL . However, I'm…
Mez
  • 24,430
  • 14
  • 71
  • 93
4
votes
1 answer

Performing Join with Multiple Criteria in Propel 1.5

This question follows on from the questions here and here. I have recently upgraded to Propel 1.5, and have started using it's Query features over Criteria. I have a query I cannot translate, however - a left join with multiple criteria: SELECT *…
Druckles
  • 3,161
  • 2
  • 41
  • 65
4
votes
3 answers

Symfony Insert SQL Error - a foreign key constraint fails

I am using fixtures to generate data for my symfony project, but for some reason the following error keeps getting thrown: Unable to execute INSERT statement. [wrapped: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a…
Pez Cuckow
  • 14,048
  • 16
  • 80
  • 130
4
votes
1 answer

How to build self referencing tables in Symfony using Propel ORM

I have an error trying to build a model from an existing database in a symfony project using the Propel ORM. The error is this: build-propel.xml:474:20: The 1:1 relationship expressed by foreign key a_table_on_my_schema_FK_1 is defined in both…
Andreu Ramos
  • 2,858
  • 2
  • 25
  • 36