propel

Propel custom Setter with SQL-specific stuff

Hello stackoverflow gurus I am using Propel 1.2 in a Symfony 1.0 project, with PostgreSQL db. I can use Criteria::CUSTOM in SELECT statements in order to use Postgres functions, like this (fulltext search): `$c = new Criteria(); $c->add(MyTablePeer::FULLTEXT_COLUMN, MyTablePeer::FULLTEXT_COLUMN." @@ to_tsquery('english', 'text to sear...

How can I select from a derived table in Propel?

I'm using v1.3 of the Propel PHP framework for an application, and I can't find a way to select from a derived table using the Criteria object. Part of the SQL I want is: SELECT unioned_table.foo, quux.stuff, baz.more_stuff... FROM quux INNER JOIN (SELECT foo, bar FROM table1 UNION SELECT foo, bar FROM table2 ) AS union...

Symfony "cannot fetch TableMap" error when using propel:build-all

Cannot fetch TableMap for undefined table: order_product. Make sure you have the static MapBuilder registration code after your peer stub class definition. Even if I erase the entire schema, clear the cache, and delete everything but "vendor" in the lib folder, I still get the error. I also get the error when doing propel:build-filter...

what does _model stand for in symfony/propel?

I change schema.yml from time to time and execute: symfony propel:build-all-load but the lib/_model and lb/model do not reflect my changes and cause: Call to undefined method ...

Database command runs glacially in my PHP script, quickly in phpMyAdmin

Hi, I have an extremely large MySQL database (about 1 million items) and am running a fairly complex query on that database. It takes about 2 seconds when I enter the SQL command into phpMyAdmin but it takes around 1-2 minutes to generate that same output using PHP code. Why would there be such a time difference? If it was a poorly ex...

How to generate propel ORM objects on virtual host with no include_path?

I have a dev server with several virtual hosts on it. Each one needs to be able to run the command: propel-gen ./ creole That script executes some php that reverse-engineers the database... BUT the php it executes needs to be included to do so. There is no include_path set in the php.ini because it would be global to all virtual hosts...

How does Propel determine which database to use for command-line tools?

How does Propel determine which database to use for command-line tools (ex. "propel:build-all")? I'm setting up two environments (production and staging), and the databases will be different for each. Is it "propel.ini" or "databases.yml"? If the former, does symfony auto-generate that file? I would greatly appreciate any help. Thank y...

Propel Row Lock Batch Update Problem

Hello, I am using Propel as my ORM. I need to do a batch update to a table with the following fields: ID Company Assigned The update will take in an array of Company and set the Assigned field to 1. The issue is there might be 2 batch updates that occur at the same time. So when that happens, I will have to accept one update, and re...

Propel: How the "Affected Rows" Returned from doUpdate is defined

In propel there is this doUpdate function, that will return the numbers of affected rows by this query. The question is, if there is no need to update the row ( because the set value is already the same as the field value), will those rows counted as the affected row? Take for example, I have the following table: ID | Name | Books 1 ...

Sql query (inner join + count + group by) using Propel

I want to show the number of comments for each blog post (along with category, date, author etc) on a page that has a list of blog posts. How do i write the following mysql query in propel? SELECT post.id, post.title, post.more_columns , COUNT(comments.post_id) AS numofcomments FROM post INNER JOIN comments ON post.id = comments.post_id...

Symfony Propel: Join Query Across different Database

I have two tables that should be joined together by a foreign key relationship, unfortunately they are separate into two different database. My question is that is it possible for me to create a Criteria thingy that allows me to create cross database join query? ...

Saving a symfony checkbox list

If you create a checkbox list in symfony 1.2 you get an array with the checked options back in the form. If you save the form, your database now contains the words "Array". Is there a way around this? Or should I just json_encode / json_decode the array as ncecessary and save it manually? Seems awfully tedious. Thanks for reading. ...

PDO not reading config correctly

I'm not sure what the problem is here, I've inherited some code form Zend Framework and it's using Propel to make DB Queries. I've changed the config file to have the right values in it, username, password, localhost and dbname however, whenever the site has to make a database call it dies with this message: Error processing connection ...

Error with Propel and ZendFramework

After inheriting some Zend Framework code it didn't work, after lots of fiddling I've managed to create the schema and rebuild the models, although now I'm getting the following error: Call to undefined method Criteria::hasSelectClause() in home/richard/library/om/BaseDomainPeer.php on line 329 Why would propel generate files that c...

howto compile Propel Criteria to SQL

Hi all! How can I compile Propel Criteria to clear SQL? I've tried $criteria->toString(); but this is not I expected. Also I've tried ModelPeer::doSelectStmt($criteria) but it returned raw sql (required parameters substitution) ...

propel:build schema driver fails

I'm doing jobeet day 3 and I copied the schema.yml into the config directory and so I'm trying to create a database schema and I ran: $sudo php symfony propel:build-schema propel Running "reverse" phing task [propel-schema-reverse] There was an error building XML from metadata: could not find driver Some problems o...

How do you preserve the updated_at date field when saving the the database in Symfony?

This has to be simple... I'm trying to preserve the current date that is already stored in an updated_at field in the DB. I'm updating a single field value in the same row and then saving but I don't want it to update the updated_at field. I want to preserve the existing updated_at value. I only want to do this in one, maybe two situa...

How to perform SQL query using Popel ORM in Symfony

Here is my problem, i'm trying to do tag cloud in symfony, what i want to perform is such a sql query select tag, count(tag) from tagi group by tag order by count(tag) desc limit 10 anyone can help? ...

AMFPHP Flex Propel Mapping class ultra-weird bug

Hello, I'm working on a website using : - Flex 3.4 - AMFPHP 1.9b - Propel 1.3 - PHP/MySQL My problem is really strange and I've been spending hours trying to know where it comes from. I'll try to focus on the problem which takes place in a whole system. To sum up, I have 2 entities (MySQL) : create table AAA ( id_AAA ...

What is causing this propel error?

I'm geting this error in propel when I run my app: PropelException: Unable to open PDO connection [wrapped: SQLSTATE[HY000] [14] unable to open database file] I've tried everything I can think of but can't figure out what is causing the problem. my build.properties is: propel.project = LinkCannon2 # The Propel driver to use for ge...