propel

Cast to a 32 bit integer may result in truncation PHP Propel?

雨燕双飞 提交于 2019-12-25 02:07:54
问题 Looking at the source code of Propel (the PHP ORM library), I have found this method inside the propel/propel1/runtime/lib/query/Criteria.php file: /** * Set offset. * * @param int $offset An int with the value for offset. (Note this values is * cast to a 32bit integer and may result in truncation) * * @return Criteria Modified Criteria object (for fluent API) */ public function setOffset($offset) { $this->offset = (int) $offset; return $this; } Why in the doc comments they say that the value

php `use` class in parent folder

孤街浪徒 提交于 2019-12-24 11:35:47
问题 I have installed Propel ORM with Composer but I cannot create a new model as the PHP script is not in the same directory as the PHP class. I have class Test inside Test.php and I want to use it from subfolder/index.php . Note that class Test then uses Base/Test from Base/Test.php , so using require() is not an option here as Base/Test just goes on to use even more classes generated by composer. Traditionally, I'm supposed to do the following: <?php use Test; ?> but since I have Test in the

Is there any way of using match against statement in Propel (ORM)?

流过昼夜 提交于 2019-12-24 10:37:34
问题 Is there any way of using match against statement in Propel (ORM)? It is odd I cannot find anything related to this. 回答1: No direct support. Perhaps a custom query? $con = Propel::getConnection(BookPeer::DATABASE_NAME); $sql = "SELECT title,category FROM articles WHERE MATCH(title,category) AGAINST (:text); $stmt = $con->prepare($sql); $stmt->execute(array(':text' => 'My match text')); 回答2: At least in Propel 1.7 it works with a where() clause: UserQuery::create()->where('MATCH(' . UserPeer:

ORM Solution for really complex queries

半世苍凉 提交于 2019-12-23 23:03:52
问题 Can/should One use any ORM Solution is a Complex Situation like this ? can this even be done with Propel or Doctrine ? at the moment I am using Propel. So I'd be glad If there is Propel solution for it. If I do a direct query with propel what are the suggestion ? SELECT I.*,((I.width*175)/I.height) as relativeWidth FROM (SELECT * FROM Image WHERE owner = 1 LIMIT 5, 10) I order by relativeWidth asc and additionally What is the standard solution for the scenario where one needs to exequte

how to override FOSUserBundle's schema file in other bundle

核能气质少年 提交于 2019-12-23 21:47:29
问题 I'm working in symfony 2.5 with propel for my project. I need to add a behavior to fos_user table so I need a way to override the original schema file in my src/ directory. Defining my project as a child of FOSUserBundle does work but this is not what I want. Is there another way? 回答1: you can copy the original schema file to your app directory and add the behavior you need. The way is exactly like overriding any twig templates from vendors. 来源: https://stackoverflow.com/questions/26376736

Use of Propel's addMultipleJoin

烈酒焚心 提交于 2019-12-23 04:41:31
问题 Following on from a previous question about sub-selects, I have an SQL statement with multiple criteria on the join, like so: SELECT * FROM person LEFT OUTER JOIN group_membership ON person.id = group_membership.person_id AND group_id = 1 WHERE group_membership.person_id is null; Unfortunately, Propel, the ORM I am using with Symfony, doesn't seem very adept using multiple joins, and previous people have tried to hack criteria together to achieve results. Doing this confused Propel, and it

Use of Propel's addMultipleJoin

寵の児 提交于 2019-12-23 04:41:04
问题 Following on from a previous question about sub-selects, I have an SQL statement with multiple criteria on the join, like so: SELECT * FROM person LEFT OUTER JOIN group_membership ON person.id = group_membership.person_id AND group_id = 1 WHERE group_membership.person_id is null; Unfortunately, Propel, the ORM I am using with Symfony, doesn't seem very adept using multiple joins, and previous people have tried to hack criteria together to achieve results. Doing this confused Propel, and it

Secure Propel connection, remote MySQL

↘锁芯ラ 提交于 2019-12-22 01:06:42
问题 Is it possible to configure Propel to use SSL connection with remote MySQL server? I found the same question with Doctrine, but it isn't answered either: How to connect to MySQL using SSL on symfony/doctrine 回答1: You can use the connection options to set PDO SSL attributes. 回答2: Here's an example for the runtime config file: $serviceContainer = Propel::getServiceContainer(); $serviceContainer->setAdapterClass($db_name, 'mysql'); $manager = new ConnectionManagerSingle(); $manager-

Propel: selecting columns from aliased join tables

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-21 20:44:53
问题 I have the following two tables: table_a: id_table_a: { type: integer, primaryKey: true, autoIncrement: true, required: true } name: { type: varchar(255) } id_table_b: { type: integer, foreignTable: table_b, foreignReference: id_table_b } table_b: id_table_b: { type: integer, primaryKey: true, autoIncrement: true, required: true } value_1: { type: varchar(255) } value_2: { type: integer } and I would like to build SQL query using select method to skip hydration, also using aliases on joined

Use of closing database connection in php

此生再无相见时 提交于 2019-12-21 11:05:52
问题 I was always in assumption that it is always a good practice to close database connection, regardless of database/ORM, like mysql_close(), Propel::close() etc. With reference to one of my other question and some other research on Internet, I came to know a surprising face that most people recommends it doesn't really matter if you close connection as connection always gets closed after the request. However I'm finding those answers little difficult to digest. Reason is, why all DB lib, ORM