propel

How do I join a table to itself multiple times in Propel?

对着背影说爱祢 提交于 2019-12-12 04:44:20
问题 I tried the solution in this answer, but it did not work. It resulted in the following SQL: SELECT user.id AS `Id`, user.name AS `Name`, AS `ReferralUser.Id`, AS `ReferralUser.Name` FROM `ReferralUser` INNER JOIN `account` ON (ReferralUser.id=account.id) Note that ReferralUser is not a table in my database, it was meant to be the alias. I need to join a table to itself at least two times, but possibly more in the future. My current code: $q = \UserQuery::create(); $q->select(array('Id', 'Name

In Symfony 1.2 how can I get the current database name from the database.yml file in Propel?

我只是一个虾纸丫 提交于 2019-12-12 04:34:57
问题 I have a raw sql query I need to run, but the database name changes in each environment (live: db, dev db_test) I need to get the current database name from the databases.yml file. How can I get just the current database name? I am using the Propel ORM 回答1: Initially I thought this would be pretty easy via sfPropelDatabase::getConfiguration() but that returns an array. As such, I had to parse the result to get the data, and I think there's probably a better way than this: $propel_config =

Performance impact of not closing propel connection

陌路散爱 提交于 2019-12-12 04:20:22
问题 I'm using symfony 1.4/propel 1.4 for a project, which was made by other developer earlier. On that project, propel connection is taken by using following code $con = Propel::getConnection(UsersPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); However it never closes the connection using Propel::close(); I just searched that there are 1500+ such incidents of opening connection & I guess none of them is closing connection. I know its always good practice to close connection but in present case,

Propel.xml gives me an error - Invalid type for path “propel.database.connections.cfs.attributes”. Expected array, but got string

南楼画角 提交于 2019-12-12 01:59:43
问题 I'm opting for an XML file for configuration, but I get the following error when i run ./vendor/bin/propel sql:build [Symfony\Component\Config\Definition\Exception\InvalidTypeException] Invalid type for path "propel.database.connections.cfs.attributes". Expected array, but got string Here is my propel.xml file <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?> <config> <propel> <database> <connections> <connection id="cfs"> <adapter>mysql</adapter> <classname>Propel\Runtime

Install propel_generator 1.2?

落花浮王杯 提交于 2019-12-11 21:06:01
问题 I'm trying to install propel_generator version 1.2 (later versions are incompatible with the project I'm working on). I've tried pear install propel/propel_generator-1.2 But I get the following error: Failed to download propel/propel_generator, version "1.2", latest release is version 1.5.2, stability "stable", use "channel://pear.propelorm.org/propel_generator-1.5.2" to install install failed Anybody know how I can install this using Pear? 回答1: The short answer is: You can't. The explanation

Relation one to one in sf1.4/propel

拟墨画扇 提交于 2019-12-11 19:05:09
问题 i have installed sfGuardPlugin and created this model: propel: sf_guard_user_profile: _attributes: { phpName: sfGuardUserProfile } id: ~ user_id: { type: integer, foreignTable: sf_guard_user, foreignReference: id, required: true, onDelete: cascade } name: varchar(50) As it is written here, http://www.propelorm.org/wiki/Documentation/1.4/Relationships (see "One-to-one relationships"), It is supposed symfony generates the function sfGuardUser->getSfGuardUserProfile() and sfGuardUserProfile-

Propel version with symfony 1.4.11

你。 提交于 2019-12-11 18:22:31
问题 I went through few post but didn't find an answer to probably one of most simple questions. What is the standard Propel version that comes bundled with symfony 1.4.11? In one answer, I found a recommendation to use the awk command but unfortunately I'm on Windows, so that command will not run for me. Another answer was to install different Propel Lib; please, no such answers. 回答1: Simply give a look to the svn repository. Each symfony version are tagged. You will see: propel http://propel

How to get related object Propel ORM

好久不见. 提交于 2019-12-11 18:20:12
问题 Working on a project with the Zend Framework, I am using Propel ORM with many related database objects. I am new to both, but I have the object models created and working. I am just trying to get my head around object access now. I have a method for creating a new user, its working good and updates related rows (Not every related, but it's a start). Now I want to present the 'New' user data to the system user (user creater). I get the username back and I now want to get the 'UserLevel' among

Need to install propel_generator version 1.3.5

試著忘記壹切 提交于 2019-12-11 17:58:44
问题 I need to install propel_generator version 1.3.5 on my machine. I tried to install it using PEAR via: pear install propel/propel_generator-1.3.5 but it failed with the following message: Failed to download propel/propel_generator, version "1.3.5", latest release is version 1.6.7, stability "stable", use "channel://pear.propelorm.org/propel_generator-1.6.7" to install install failed Following this answer I checked http://pear.propelorm.org/Chiara_PEAR_Server_REST/r/propel_generator/allreleases

Propel ORM UNION query

[亡魂溺海] 提交于 2019-12-11 14:19:36
问题 I have three criteria objects $c1, $c2, $c3 I want to return the union set of all three i.e.: ($c1 || $c2 || $c3) I have a function that expects a Criteria object, so I need to be able to return a criteria that represents the UNION of $c1, $c2 and $c3. Does anyone know how to achieve that? 回答1: You can do that with criterions: <?php $c = new Criteria(); $cton1 = $c->getNewCriterion(AuthorPeer::FIRST_NAME, "Leo"); $cton2 = $c->getNewCriterion(AuthorPeer::LAST_NAME, array("Tolstoy", "Dostoevsky