propel

how to translate this query into Criteria ??

Hi, I try to translate this query into Criteria (with Propel), but without success. Can you help me please ? SELECT DISTINCT (email) FROM user, travail WHERE travail.id_user = user.id_user AND id_site = "1" AND `droits` = "1" This my Criteria query : $c = new Criteria(); $c->add(self::DROITS, 1, Criteria::EQUAL); $c->add(Trav...

IF statement in Propel select criteria

Hi everyone, I am trying to incorporate an IF statement into my propel criteria. This is the how I build up my criteria: $c = is_object($c) ? $c : new Criteria(); $c->addSelectColumn("CONCAT(DAYOFYEAR(" . SomePeer::CREATED_AT . "), ' ', YEAR(" . SomePeer::CREATED_AT . ")) AS period"); $c->addSelectColumn("COUNT(" . SomePeer::ID . ") AS...

Symfony / Propel - retrieving old dates from a database

This is regarding Symfony 1.4, and probably all prior versions, running php 5.3, mysql 5.1. If I store old dates in a database < 1970..., and I then retrieve them, they are automatically converted into an incorrect date. Example table: id, some_date 1, 1961-09-09 A quick example. $record = MyTablePeer::retrieveByPK(1); echo $record...

Is it possible to 'prepare' a Propel 1.4 Criteria so it can be used efficiently inside a loop?

I'm using symfony 1.3 with Propel 1.4. I need to use a prepared query that will be used inside a loop changing the values of bound parameters. Is it possible to do this with Propel 1.4? I want to retrieve results as objects so don't want to use raw SQL if I can help it. ...

Symfony 1.4 using Propel 1.5 with multiple databases

I am creating a Symfony 1.4 project using Propel 1.5. I would like to know if this can support multiple databases ...

Doctrine Schema changes to id auto-increment

I'm using YAML to define the doctrine schema and would like to start the id field that's set on auto-increment with a number other than 0, let's say 324 (this is done in mysql by doing something like AUTO_INCREMENT=324. This Google groups thread has a hint that it may be possible to do with command.pre_command event to execute the SQL b...

How to Zend Framework with Propel ORM

I'd like to integrate Propel with Zend framework. I've seen the integration of doctrine in the past but this post says it seems propel is done a bit differently. Propel has two things going for it already: the first is that Propel includes its own autoloader, meaning that I didn’t have to try and force Propel into Zend Framew...

How to execute a propel query?

Hi, how to execute a propel query? For example this: $c = new Criteria(); $c->add(AuthorPeer::NAME, $name); I know Doctrine method is execute() but using propel? Regards Javi ...

How do I find a list of subclasses for a propel model with concrete inheritance

I'm building a mini-cms for my local charity (yes, I know I could use a floss project, but they want custom coded) My propel schema currently looks as such:- <?xml version="1.0" encoding="UTF-8"?> <database name="sja" defaultIdMethod="native"> <table name="section"> <column name="id" type="INTEGER" primaryKey="true" require...

Propel: what is the equivalent of OR in SQL?

Hi, what is the method to create OR? I mean: I know to craate this SQL clause: SELECT * FROM author WHERE author.FIRST_NAME = 'Karl' AND author.LAST_NAME <> 'Marx'; I should do this: <?php $c = new Criteria(); $c->add(AuthorPeer::FIRST_NAME, "Karl"); $c->add(AuthorPeer::LAST_NAME, "Marx", Criteria::NOT_EQUAL); $authors = AuthorPeer...

How to convert the SQLs of the symfony development bar to the MySQL SQLs ?

Hi, just that. Im using propel. REgards Javi ...

What kind of SQL clause is this? Any way to convert it to SQL?

Hi, what kind of SQL is this? SELECT IFNULL(SUM(prenotazione.VALUTAZIONE),0) AS somma, COUNT(*) AS numero FROM `prenotazione` WHERE prenotazione.USER_ID=18793 AND prenotazione.PRENOTAZIONE_STATO_ID IN (10,11) Im using propel as my ORM. Any way to convert that kind of SQL to Mysql SQL? regards Javi ...

Propel: trying to get the equivalent MySQL clause.

Hi, I have this propel criteria, and then I try to print the equivalent MySQL clause: $c = new Criteria(); $c->add(self::USER_ID, 18793); $result = self::doSelect($c); echo $c->toString(); But tt print this: Criteria: SQL (may not be complete): SELECT FROM prenotazione WHERE prenotazione.USER_ID=:p1 Params: prenotazione.US...

Propel - best practice for implementing a method - shall I save the object inside or outside the method

Hi all. I am using Propel, a PHP ORM. I really like it. I love to be able to write this code: $offer->setTitle('20% off everything')->save(); But what about if I want to create a increaseImpressions method?. Would you use it like this: $offer->increaseImpressions() or like this: $offer->increaseImpressions()->save() ? ...

Propel: newbie problems with a criteria. Trying to debug.

Hi, I have this criteria propel. public static function getPrenotazioniAttive($id_utente) { $c = new Criteria(); $c->add(self::USER_ID, 18793 ); $result = self::doSelect($c); } After that i add this: echo $c->toString(); that shows: Criteria: SQL (may not be complete): SELECT FROM `prenotazione` WHERE prenotazione.USER_ID=:p1 ...

How to write this class for Django's data model (converting from Propel's YML format)

I am converting a web project that currently uses the Propel ORM, to a django project. My first task is to 'port' the model schema to django's. I have read the django docs, but they do not appear to be in enough detail. Case in point, how may I 'port' a (contrived) table defined in the Propel YML schema as follows: demo_ref_country:...

Propel/symfony: problem with a criteria

Hi, I have this query inside a method: public static function pincopalla(){ $con = Propel::getConnection(SediI18nPeer::DATABASE_NAME); $sql = "select * from sedii18n where culture = :country UNION select * from sedii18n where culture <> :country"; $stmt = $con->prepare($sql); $result = $stmt->execute(a...

How to update database connection details in symfony (maybe propel?)

I don't develop with symphony but need to update the database connection details for a couple websites developed by third parties running it. They appear to make use of propel. I've updated the dsn in database.yml but this has just taken the site offline (500 error) Any idea what I might have done wrong or may need to do to force the ...

Symfony/Propel: i18n tables

Hi, i have this schema and fixtures: sedi: _attributes: { isI18N: true, i18nTable: sediI18n } id: ~ sediI18n: id: { type: integer, required: true, primaryKey: true, foreignTable: sedi, foreignReference: id } culture: { isCulture: true, type: varchar, size: 7, required: true, primaryKey: true } paes...

Symfony/propel: new line in text in propel schema, how?

Hi, I have this: SediI18n: XXXXXX: { id: sede_foo_1, culture: it, paese_indirizzo: it, ufficio: "Ufficio di XXX 1", indirizzo: "Foo Bar FooBar" } Now, when i prints this register the field "indirizzo": Foo Bar FooBar Everything is in one line. Any way to write the value of "indirizzo" to print directly in my web page some...