Questions tagged [propel2]

Propel2 is the next major version of an open-source Object-Relational Mapping (ORM) for PHP5. It allows you to access your database using a set of objects, providing a simple API for storing and retrieving data.

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

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:

68 questions
1
vote
1 answer

Fail to run propel command

I have some old systems that run Propel 2 on PHP 5. Now I try to upgrade the OS and PHP. The PHP version I use is 7.3.7 I can install propel successfully via composer but when I run propel command I got an error. PS D:\code\testPropel>…
Anurat Chapanond
  • 2,837
  • 3
  • 18
  • 31
1
vote
0 answers

How can I get the values from a non-direct relation in Propel2?

I'm writing a script that loads all the news from our database using Propel2. My current code looks as follows: $news = NewsQuery::create()->find(); This gives me the following Output: Array ( [0] => Array ( [Id] => 1 …
Finlay Roelofs
  • 533
  • 6
  • 21
1
vote
0 answers

Ordered persistence within a Propel transaction

I'm trying to make use of a lifecycle callback in Propel, postInsert. The issue that I'm running into is that there is a chicken/egg scenario due to the persistence ordering of INSERTs and database FK constraints. In the callback, I need the…
Jacob Thomason
  • 3,062
  • 2
  • 17
  • 21
1
vote
1 answer

Select only calculated columns in Propel

I'm trying to perform a selection with Propel which returns only calculated columns, but I allways have other columns selected. For example: $criteria = new MuestraQuery(); $criteria->clearSelectColumns() ->addAsColumn('numEspesores',…
Alvaro Maceda
  • 604
  • 1
  • 7
  • 21
1
vote
0 answers

Propel ORM: Query searches for table name in starting character in uppercase

I am using Propel ORM This…
Jnanaranjan
  • 1,304
  • 15
  • 31
1
vote
0 answers

Propel reverse generating tables but no column information in schema.xml

I am using Propel 2 with Postgres database. When I run the following command, it appears to work, but in the generated schema.xml file, I do not get any column information: vendor\bin\propel reverse -v --verbose "db" Reading database structure of…
catscancode
  • 115
  • 1
  • 7
1
vote
1 answer

Is it possible to inject random rows into an existing Propel ORM query?

Let's say I have a database table called article, and each article is assigned a type (1 = standard article, 2 = sponsored article, etc.). Using Propel 2, is it possible to do the following? Step 1: Select the 10 latest articles, ordered descending,…
Nick S.
  • 353
  • 3
  • 13
1
vote
0 answers

Propel2; how to use querybuilder for subselect query

Problem: I'm having trouble finding a solution building a query with QueryBuilder (perhaps getting it done with regular sql query first will help): Trying to retrieve all customers for a user (has shop credits at one of the shops user is linked…
Leentje
  • 134
  • 2
  • 14
1
vote
1 answer

what is the difference between collection and array in php (propel)?

Collections And On-Demand Hydration The advantage of using a collection instead of an array is that Propel can hydrate model objects on demand. Using this feature, you'll never fall short of memory when retrieving a large number of results.…
Amin
  • 413
  • 6
  • 12
1
vote
1 answer

How to have views on the Propel orm as a query class?

I have a database with two tables and one view, I use propel init for creating a project, now when I just have my two tables on the Propel created files and I can just get query from my tables I don't access to my view for getting the query from it!…
X.Strange
  • 175
  • 1
  • 16
1
vote
0 answers

Is the object guaranteed to have ID in postSave? [Propel2]

When saving an object in Propel2 is it guaranteed to have ID in postSave? I'm having trouble finding an answer to this.
MurkyMuck
  • 126
  • 1
  • 10
1
vote
0 answers

Propel ORM: Changing connection settings for diff and migrate

So I'm currently developing a little project using Propel ORM (v2.00-dev), and I figured I'd try using Vagrant for the first time. I've set up the vagrant server to allow external MySQL connections, and built the following config file, so I don't…
Sam
  • 1,315
  • 2
  • 13
  • 27
1
vote
1 answer

Transaction with more than one table in Propel2

In the documentation of Propel2 ORM (http://propelorm.org/documentation/05-transactions.html) there is an example how to wrap queries inside a transaction. The connection is made to a single database table "Account": $con =…
jengeb
  • 393
  • 1
  • 7
  • 21
1
vote
1 answer

Propel2, createdBy field

Let's say I have model "Question". Every question is created by user (current user). How to "auto" update createdBy to current.user In Doctrine2 I should have event listener with dependency on security.context. And event will subscribe for…
po_taka
  • 1,816
  • 17
  • 27
1
vote
1 answer

Propel2 collections disappear on update

My colleagues and I have written a dozen web applications using Symfony2 and Propel1. We are now trying to use Propel2 but encounter the following problem when migrating an application from Propel1 to Propel2. In our simple schema, a parent object,…