Search Results

Search found 76 results on 4 pages for 'propel'.

Page 1/4 | 1 2 3 4  | Next Page >

  • Should I choose Doctrine 2 or Propel 1.5/1.6, and why?

    - by Billy ONeal
    I'd like to hear from those who have used Doctrine 2 (or later) and Propel 1.5 (or later). Most comparisons between these two object relational mappers are based on old versions -- Doctrine 1 versus Propel 1.3/1.4, and both ORMs went through significant redesigns in their recent revisions. For example, most of the criticism of Propel seems to center around the "ModelName Peer" classes, which are deprecated in 1.5 in any case. Here's what I've accumulated so far (And I've tried to make this list as balanced as possible...): Propel Pros Extremely IDE friendly, because actual code is generated, instead of relying on PHP magic methods. This means IDE features like code completion are actually helpful. Fast (In terms of database usage -- no runtime introspection is done on the database) Clean migration between schema versions (at least in the 1.6 beta) Can generate PHP 5.3 models (i.e. namespaces) Easy to chain a lot of things into a single database query with things like useXxx methods. (See the "code completion" video above) Cons Requires an extra build step, namely building the model classes. Generated code needs rebuilt whenever Propel version is changed, a setting is changed, or the schema changes. This might be unintuitive to some and custom methods applied to the model are lost. (I think?) Some useful features (i.e. version behavior, schema migrations) are in beta status. Doctrine Pros More popular Doctrine Query Language can express potentially more complicated relationships between data than easily possible with Propel's ActiveRecord strategy. Easier to add reusable behaviors when compared with Propel. DocBlock based commenting for building the schema is embedded in the actual PHP instead of a separate XML file. Uses PHP 5.3 Namespaces everywhere Cons Requires learning an entirely new programming language (Doctrine Query Language) Implemented in terms of "magic methods" in several places, making IDE autocomplete worthless. Requires database introspection and thus is slightly slower than Propel by default; caching can remove this but the caching adds considerable complexity. Fewer behaviors are included in the core codebase. Several features Propel provides out of the box (such as Nested Set) are available only through extensions. Freakin' HUGE :) This I have gleaned though only through reading the documentation available for both tools -- I've not actually built anything yet. I'd like to hear from those who have used both tools though, to share their experience on pros/cons of each library, and what their recommendation is at this point :)

    Read the article

  • Using Propel ORM in my own custom classes

    - by Stick it to THE MAN
    I am refactoring a few classes I wrote a while ago, into my Symfony project (v1.3.2 with Propel ORM). The classes originally used direct connections to the database, I want to refactor those classes (stored in $(SF_LIB_DIR)) so that I can call propel and also use the ORM objects. To clarify, So for example, I want to be able to use code like this in my custom classes: try { $con = Propel::getConnection(); $c = new Criteria(); $foo = new PropelORMFooObject(); $foobar = PropelORMFooBarObjectPeer::fetch($c); //set fields etc $foo->setFooBar($foobar); // now save using obtained connection .. $foo->save($con) }catch(SomeException $e) { //deal with it } I assume that I will need to add some require_once() statements to my custom libraries, but it is not clear which files to include. Does anyone know how to do this?

    Read the article

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

    - by James Skidmore
    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-filters or propel:build-forms. Thanks for your help in advance!

    Read the article

  • Zend_Form Creation for Propel Objects

    - by Mez
    I'm currently working on a project where I use Zend Framework with Propel. I'm looking for something that'll create Zend_Forms for Propel objects, preferably in a similar way to django's modelforms Is there anything out there that does this already, and if not, what would be the best way to go about creating something like this?

    Read the article

  • Propel-load-data is causing an error

    - by Jon Winstanley
    I am trying to load fixtures but myproject is erroring at the CLI and starting the indexer process. I have tried: Rebuilding the schema and model Emptying the database and starting again Clearing the cache Validating the YML file and trying much simpler data-dumps My platform is Symfony 1.0 on Windows Some also seems to have had the same issue in the past. C:\web\my_project>symfony propel-load-data backend >> propel load data from "C:\web\my_project\data\fixtures" PHP Warning: session_start(): Cannot send session cookie - headers already sent by (output started at C:\php\PEAR\symfony\vendor\pake\pakeFunction.php:366) in C:\php\PEAR\symfony\storage\sfSessionStorage.class.php on line 77 Warning: session_start(): Cannot send session cookie - headers already sent by (output started at C:\php\PEAR\symfony\vendor\pake\pakeFunction.php:366) in C:\php\PEAR\symfony\storage\sfSessionStorage.class.php on line 77 PHP Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at C:\php\PEAR\symfony\vendor\pake\pakeFunction.php:366) in C:\php\PEAR\symfony\storage\sfSessionStorage.class.php on line 77 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at C:\php\PEAR\symfony\vendor\pake\pakeFunction.php:366) in C:\php\PEAR\symfony\storage\sfSessionStorage.class.php on line 77

    Read the article

  • Selecting date NOT NULL records between a specific range with Propel

    - by Jon Winstanley
    Using Propel I would like to find records which have a date field which is not null and also between a specific range. However, Propel seems to overwrite the criteria with the NOTNULL criteria. Is it possible to do this? //create the date ranges $start_date = mktime(0, 0, 0, date("m") , date("d")+$start, date("Y")); $end_date = mktime(0, 0, 0, date("m") , date("d")+$end, date("Y")); //add the start of the range $c1 = $c->getNewCriterion(TaskPeer::DUE_DATE, null); $c1->addAnd($c->getNewCriterion(TaskPeer::DUE_DATE, $end_date, Criteria::LESS_EQUAL)); $c->add($c1); //add the end of the range $c2 = $c->getNewCriterion(TaskPeer::DUE_DATE, null); $c2->addAnd($c->getNewCriterion(TaskPeer::DUE_DATE, $start_date, Criteria::GREATER_EQUAL)); $c->add($c2); //remove the null entries $c3 = $c->getNewCriterion(TaskPeer::DUE_DATE, null); $c3->addAnd($c->getNewCriterion(TaskPeer::DUE_DATE, null, Criteria::ISNULL)); $c->add($c3);

    Read the article

  • PHP ORMs: Doctrine vs. Propel

    - by Tom
    Hi, I'm starting a new project with symfony which is readily integrated with Doctrine and Propel, but I of course need to make a choice.... I was wondering if more experienced people out there have general pros and/or cons for going with either of these two? Thanks a lot. EDIT: Thanks for the all the responses, useful stuff. There's no truly correct answer to this question so I'll just mark as approved the one that got the most popular up-votes.

    Read the article

  • Propel automatic form

    - by martin.malek
    Hi, I'm just starting with Propel and for more rapid development I'm curious if there is anything like automatic forms. Something like default administration in Django. I want to be able to output a form or to get all information I'll need. Even in the objects I didn't find all information which should be necessary to have everything for the form (name, type, length, related object, etc).

    Read the article

  • Adding custom columns to Propel model?

    - by Hard-Boiled Wonderland
    At the moment I am using the below query: $claims = ClaimQuery::create('c') ->leftJoinUser() ->withColumn('CONCAT(User.Firstname, " ", User.Lastname)', 'name') ->withColumn('User.Email', 'email') ->filterByArray($conditions) ->paginate($page = $page, $maxPerPage = $top); However I then want to add columns manually, so I thought this would simply work: foreach($claims as &$claim){ $claim->actions = array('edit' => array( 'url' => $this->get('router')->generate('hera_claims_edit'), 'text' => 'Edit' ) ); } return array('claims' => $claims, 'count' => count($claims)); However when the data is returned Propel or Symfony2 seems to be stripping the custom data when it gets converted to JSON along with all of the superflous model data. What is the correct way of manually adding data this way?

    Read the article

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

    - by Ngu Soon Hui
    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 | S1oon | Me 2 | S1oon | Me Let's assume that I write a ORM function of the equivalent of the following query: update `new table` set Books='Me' where Name='S1oon'; What will the doUpdate result return? Will it return 0 ( because all the Books column are already Me, hence there is no need to update), or will it be 2 ( because there are 2 rows that fulfill the where condition) ?

    Read the article

  • Propel Single Table Inheritance Issue

    - by lo_fye
    I have a table called "talk", which is defined as abstract in my schema.xml file. It generates 4 objects (1 per classkey): Comment, Rating, Review, Checkin It also generates TalkPeer, but I couldn't get it to generate the other 4 peers (CommentPeer, RatingPeer, ReviewPeer, CheckinPeer), so I created them by hand, and made them inherit from TalkPeer.php, which inherits from BaseTalkPeer. I then implemented getOMClass() in each of those peers. The problem is that when I do queries using the 4 peers, they return all 4 types of objects. That is, ReviewPeer will return Visits, Ratings, Comments, AND Reviews. Example: $c = new Criteria(); $c->add(RatingPeer::VALUE, 5, Criteria::GREATER_THAN); $positive_ratings = RatingPeer::doSelect($c); This returns all comments, ratings, reviews, & checkins that have a value 5. ReviewPeer should only return Review objects, and can't figure out how to do this. Do I actually have to go through and change all my criteria to manually specify the classkey? That seems a little pointless, since the Peer name already distinct. I don't want to have to customize each Peer. I should be able to customize JUST the TalkPeer, since they all inherit from it... I just can't figure out how. I tried changing doSelectStmt just in TalkPeer so that it automatically adds the CLASSKEY restriction to the Criteria. It almost works, but I get a: Fatal error: Cannot instantiate abstract class Talk in /models/om/BaseTalkPeer.php on line 503. Line 503 is in BaseTalkPeer::populateObjects(), and is the 3rd line below: $cls = TalkPeer::getOMClass($row, 0); $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); $obj = new $cls(); The docs talked about overriding BaseTalkPeer::populateObject(). I have a feeling that's my problem, but even after reading the source code, I still couldn't figure out how to get it to work. Here is what I tried in TalkPeer::doSelectStmt: public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) { $keys = array('models.Visit'=>1,'models.Comment'=>2,'models.Rating'=>3,'models.Review'=>4); $class_name = self::getOMClass(); if(isset($keys[$class_name])) { //Talk itself is not a returnable type, so we must check $class_key = $keys[$class_name]; $criteria->add(TalkPeer::CLASS_KEY, $class_key); } return parent::doSelectStmt($criteria, $con = null); } Here is an example of my getOMClass method from ReviewPeer: public static function getOMClass() { return self::CLASSNAME_4; //aka 'talk.Review'; } Here is the relevant bit of my schema: <table name="talk" idMethod="native" abstract="true"> <column name="talk_pk" type="INTEGER" required="true" autoIncrement="true" primaryKey="true" /> <column name="class_key" type="INTEGER" required="true" default="" inheritance="single"> <inheritance key="1" class="Visit" extends="models.Talk" /> <inheritance key="2" class="Comment" extends="models.Talk" /> <inheritance key="3" class="Rating" extends="models.Talk" /> <inheritance key="4" class="Review" extends="models.Rating" /> </column> </table> P.S. - No, I can't upgrade from 1.3 to 1.4. There's just too much code that would need to be re-tested

    Read the article

  • Symfony/Propel NestedSet left/right ID corruption/adjustment

    - by Mike Crowe
    Hi folks, I have a nested set application that seems to be getting corrupted. Here's what I'm seeing: We're using nested sets for a binary tree (any node can have 2 children). It appears to be working fine, but some event causes a discrepancy. For instance, when I do a getNumberOfDescendants() for the root node, it will slowly increase as this event happens. However, displaying the tree works fine, as does inserting (apparently). Has anybody seen anything like this before? For instance, my repair program shows this as the repairs that it makes: User pxxxxx left 0=>0, right 145=>129 User axxxxx left 1=>1, right 124=>106 User mxxxxx left 119=>117, right 120=>118 User fxxxxx left 125=>107, right 144=>128 User fxxxxx left 126=>108, right 131=>113 User rxxxxx left 127=>109, right 128=>110 User mxxxxx left 129=>111, right 130=>112 User mxxxxx left 132=>114, right 143=>127 User cxxxxx left 133=>115, right 142=>126 User gxxxxx left 134=>116, right 137=>121 User mxxxxx left 135=>119, right 136=>120 User jxxxxx left 138=>122, right 141=>125 User axxxxx left 139=>123, right 140=>124 I thought at first it was when I deleted a user, but it has since occurred w/o that event. Anybody know of a cause that might generate this? I've tested ad nauseum on my local machine, but I can't duplicate it. I do have an issue where my production box is PHP 5.2.0, whereas my test device is 5.2.10. Could that be an issue? TIA Mike

    Read the article

  • Symfony 1.4: use relations in fixtures with propel

    - by iggnition
    Hello, I just started to use the PHP symfony framework. Currently I'm trying to create fixture files in YAML to easily insert data into my MySQL database. Now my database has a couple of relations, I have the tables Organisation and Location. Organisation org_id (PK) org_name Location loc_id (PK) org_id (FK) loc_name Now I'm trying too link these tables in my fixture file, but for the life of me I cannot figure out how. Since the org_id is auto-incremented I can't simply use org_id: 1 In the location fixture. How can I fix this?

    Read the article

  • How to join a table in symfony (Propel) and retrieve object from both table with one query

    - by Jean-Philippe
    Hi, I'm trying to get an easy way to fetch data from two joined Mysql table using Propel (inside Symfony) but in one query. Let's say I do this simple thing: $comment = CommentPeer::RetrieveByPk(1); print $comment->getArticle()->getTitle(); //Assuming the Article table is joined to the Comment table Symfony will call 2 queries to get that done. The first one to get the Comment row and the next one to get the Article row linked to the comment one. Now, I am trying to find a way to make all that within one query. I've tried to join them using $c = new Criteria(); $c->addJoin(CommentPeer::ARTICLE_ID, ArticlePeer::ID); $c->add(CommentPeer::ID, 1); $comment = CommentPeer::doSelectOne($c); But when I try to get the Article object using $comment->getArticle() It will still issue the query to get the Article row. I could easily clear all the selected columns and select the columns I need but that would not give me the Propel object I'd like, just an array of the query's raw result. So how can I get a populated propel object of two (or more) joined table with only one query? Thanks, JP

    Read the article

  • Symfony app - how to add calculated fields to Propel objects?

    - by Thomas Kohl
    What is the best way of working with calculated fields of Propel objects? Say I have an object "Customer" that has a corresponding table "customers" and each column corresponds to an attribute of my object. What I would like to do is: add a calculated attribute "Number of completed orders" to my object when using it on View A but not on Views B and C. The calculated attribute is a COUNT() of "Order" objects linked to my "Customer" object via ID. What I can do now is to first select all Customer objects, then iteratively count Orders for all of them, but I'd think doing it in a single query would improve performance. But I cannot properly "hydrate" my Propel object since it does not contain the definition of the calculated field(s). How would you approach it?

    Read the article

  • Loader.php trying to load Doctrine classes, but we use Propel!

    - by kewpiedoll99
    We are finding cases where we get the following 500 error: File xyz.php does not exist or class "xyz" was not found in the file at () in SF_ROOT_DIR/lib/vendor/Zend/Loader.php line 107 ... where xyz == Memcache (when trying to use symfony cc on the command line) or sfDoctrineAdminGenerator (when using an old-ish AdminGenerator-generated CMS page). We use Propel, but Loader.php is trying to load classes used only for Doctrine. Currently I am using a filthy hack where I request Loader.php to check if the file is either of these two cases, and if so simply return rather than trying to load it. Obviously, this is unacceptable longer term. Has anybody encountered this, and how did you solve it? Edited to add: We have: class ProjectConfiguration extends sfProjectConfiguration { public function setup() { // for compatibility / remove and enable only the plugins you want $this->enableAllPluginsExcept(array('sfDoctrinePlugin')); } } And we have a propel.ini file in our top level config directory. This has only started in the past four weeks or so, and we've had a stable build for over a year now. I'm pretty sure Doctrine is totally disabled.

    Read the article

  • symfony/propel: problem trying to add a new object action in a backend module

    - by user248959
    Hi, i have created this model: propel: shop_orders: orders_id: { phpName: Id, type: INTEGER, size: '11', primaryKey: true, autoIncrement: true, required: true } email: { type: VARCHAR, size: '45', required: true } Then i have generated an admin module and i have add this below to generator.yml: config: actions: ~ fields: ~ list: object_actions: foo: {} When I click on the foo action It generates this url: backend_dev.php/sp1/ListFoo/action?id=1 and I get this message: Action "sp1/action" does not exist. sf 1.4/propel Any idea? Javier

    Read the article

  • php paging class

    - by Stick it to THE MAN
    Can anyone recommend a good PHP paging class? I have searched google, but have not seen anything that matches my requirements. Rather than "rolling my own" (and almost surely reinventing the wheel), I decided to check in here first. First some background: I am developing a website using Symfony 1.3.2 with Propel ORM on Ubuntu 9.10. I am currently using the Propel pager, which is OK, but I recently started using memcache to speed things up a little. At this point, the Propel pager is of little use, as it (AFAIK), only works with Propel objects. What I need is a class th:t meets the following requirents Has clean interface, with separation of concerns, so that the logic to retrieve records from the datasource (e.g. database) is encapsulated in a class (or at least a separate file). Can work with arrays of objects Provides pagination links, and only fetches the data required for the current page. Also, the pagination should 'split' the available page links if there are too many. For example, if there are potentially 1000 possible page links, the pages displayed should be something like FIRST 2,3 ....999 LAST Can return the number of all the records in the table being queried, so that the following links are available FIRST, LAST (this requirement is actually already covered in the previous requirement - but I just wanted to re-emphasise it). Can anyone recommend such a library, if they have used it succesfully in the past? Alternatively, someobe may have 'hacked' (e.g. derived from) the current Propel pager, to get it to do the things I listed about - please let me know.

    Read the article

  • Attempt to set foreign key to nonexistent table, sf_guard_user!

    - by Stick it to THE MAN
    I am using SF 1.3.2 with Propel ORM on Ubuntu 9.10. I created a new SF project and simply copied the sfGuard plugin folder from a pre-existing SF 1.32 project. I manually edited the schema.yml in the new project, adding a user table that reference the the sfGuard table. When I run propel:build-sql, I got the task failed, with the error message: Attempt to set foreign key to nonexistent table, sf_guard_user! I'm not sure why this error is occurring, (the error dosent make sense to me, since the sfGuard plugin works fine with the previous project, with no changes made. what am I missing?? BTW, I have not created any apps in the project yet. I am just running the build-sql task first, to make sure that Propel has no problems with parsing my yml files etc.

    Read the article

1 2 3 4  | Next Page >