Search Results

Search found 404 results on 17 pages for 'doctrine odm'.

Page 3/17 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • symfony 1.4: doctrine build model warning

    - by tigerstyle
    Hi volks, I copied my sources from my lokal dev (everything works fine) to my repository and from there I did a checkout on my remote dev. Now when I try to build everything I get this error: devel:/var/www/myproject# ./symfony doc:build-model doctrine generating model classes file+ /tmp/doctrine_schema_48726.yml Warning: file_get_contents(/var/www/myproject/lib/model/doctrine//base/BaseAdvert.class.php): failed to open stream: No such file or directory in /var/www/myproject/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildModelTask.class.php on line 77 Do you know what the problem could be? Thx for your answers :)

    Read the article

  • MySQL Queries using Doctrine & CodeIgniter

    - by 01010011
    Hi, How do I write plane SQL queries using Doctrine connection object and display the results? For example, how do I perform: SELECT * FROM table_name WHERE column_name LIKE '%anything_similar_to_this%'; using Doctrine something like this (this example does not work) $search_key = 'search_for_this'; $conn = Doctrine_Manager::connection(); $conn->execute('SELECT * FROM table_name WHERE column_name LIKE ?)', $search_key); echo $conn;

    Read the article

  • How to profile Doctrine in Zend Framework

    - by David Zapata
    Good day. I'm using Doctrine as ORM for my Zend Framework project. This is the first time I use it. I've followed the ZendCasts Doctrine chapters, and everything works for me, but I needed to perform some profiling; There is a Doctrine_Connection_Profiler class that should be used to profile the Doctrine Model internal queries, but I've tried to use it without success. I always get a "PDOException: You cannot serialize or unserialize PDOStatement instances" exception when I perform my Unit Tests. Here is a example: $conn = Doctrine_Manager::connection($doctrineConfig['dsn'], $dbconfname); ... if( APPLICATION_ENV != 'production'){ $obj_doctrine_profiler = new Doctrine_Connection_Profiler(); $conn->setListener($obj_doctrine_profiler); } All of my Unit Tests works if I comment/delete the $conn->setListener($obj_doctrine_profiler); line. This code block is located in my Bootstrap.php class; the weird thing is, the web application works just fine even with the mentioned code line. Thank you so much for your help. please excuse me if my english is not the best.

    Read the article

  • DQL delete from multiple tables (doctrine)

    - by singer
    Need to perform DQL delete from multple related tables. In SQL it is something like this: DELETE r1,r2 FROM ComRealty_objects r1, com_realty_objects_phones r2 WHERE r1.id IN (10,20) AND r2.id_object IN (10,20) I need to perform this statement using DQL, but I'm stuck on this :( <?php $dql = Doctrine_Query::create() ->delete('phones, comrealtyobjects') ->from('ComRealtyObjects comrealtyobjects') ->from('ComRealtyObjectsPhones phones') ->whereIn("comrealtyobjects.id", $ids) ->whereIn("phones.id_object", $ids); echo($dql->getSqlQuery()); ?> But DQL parser gives me this result: DELETE FROM `com_realty_objects_phones`, `ComRealty_objects` WHERE (`id` IN (?) AND `id_object` IN (?)) Searching google and stack overflow I found this(useful) topic: http://stackoverflow.com/questions/2247905/what-is-the-syntax-for-a-multi-table-delete-on-a-mysql-database-using-doctrine But this is not exactly my case - there was delete from single table. If there is a way to override dql parser behaviour? Or maybe some other way to delete records from multiple tables using doctrine. Note: If you are using doctrine behaviours(Doctrine_Record_Generator) you need first to initialize those tables using Doctrine_Core::initializeModels() to perform DQL operations on them.

    Read the article

  • Doctrine Default Primary Key Problem (Again)

    - by 01010011
    Hi, Should I change all of my uniquely-named MySQL database primary keys to 'id' to avoid getting errors related to Doctrine's default primary key set in the plugin 'doctrine_pi.php'? To further elaborate, I am getting the following reoccurring error, this time after trying to login to my login page: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'u.book_id' in 'field list'' in... I suspect the problem resides at a MySQL table used for my login, of which has a primary key called id Marc B originally solved an identical problem for me in this post http://stackoverflow.com/questions/2702229/doctrine-codeigniter-mysql-crud-errors when I had the same problem with a different table within the same database. Following his suggestion, I changed the default primary key located at system/application/plugins/doctrine_pi.php from 'id' to 'book_id': <?php // system/application/plugins/doctrine_pi.php ... // set the default primary key to be named 'id', integer, 4 bytes Doctrine_Manager::getInstance()->setAttribute( Doctrine::ATTR_DEFAULT_IDENTIFIER_OPTIONS, array('name' => 'book_id', 'type' => 'integer', 'length' => 4)); and that solved my previous problem. However, my login page stopped working. So what is the safe thing to do? Change all of my primary keys to 'id' (will that solve the problem without causing some other problem I am not aware of). Or should I add some lines of code in doctrine_pi.php?

    Read the article

  • Doctrine - get the offset of an object in a collection (implementing an infinite scroll)

    - by dan
    I am using Doctrine and trying to implement an infinite scroll on a collection of notes displayed on the user's browser. The application is very dynamic, therefore when the user submits a new note, the note is added to the top of the collection straightaway, besides being sent (and stored) to the server. Which is why I can't use a traditional pagination method, where you just send the page number to the server and the server will figure out the offset and the number of results from that. To give you an example of what I mean, imagine there are 20 notes displayed, then the user adds 2 more notes, therefore there are 22 notes displayed. If I simply requests "page 2", the first 2 items of that page will be the last two items of the page currently displayed to the user. Which is why I am after a more sophisticated method, which is the one I am about to explain. Please consider the following code, which is part of the server code serving an AJAX request for more notes: // $lastNoteDisplayedId is coming from the AJAX request $lastNoteDisplayed = $repository->findBy($lastNoteDisplayedId); $allNotes = $repository->findBy($filter, array('createdAt' => 'desc')); $offset = getLastNoteDisplayedOffset($allNotes, $lastNoteDisplayedId); // retrieve the page to send back so that it can be appended to the listing $notesPerPage = 30 $notes = $repository->findBy( array(), array('createdAt' => 'desc'), $notesPerPage, $offset ); $response = json_encode($notes); return $response; Basically I would need to write the method getLastNoteDisplayedOffset, that given the whole set of notes and one particoular note, it can give me its offset, so that I can use it for the pagination of the previous Doctrine statement. I know probably a possible implementation would be: getLastNoteDisplayedOffset($allNotes, $lastNoteDisplayedId) { $i = 0; foreach ($allNotes as $note) { if ($note->getId() === $lastNoteDisplayedId->getId()) { break; } $i++; } return $i; } I would prefer not to loop through all notes because performance is an important factor. I was wondering if Doctrine has got a method itself or if you can suggest a different approach.

    Read the article

  • Join query in doctrine symfony

    - by THOmas
    I have two tables userdetails and blog question The schema is UserDetails: connection: doctrine tableName: user_details columns: id: type: integer(8) fixed: false name: type: string(255) fixed: false BlogQuestion: connection: doctrine tableName: blog_question columns: question_id: type: integer(8) fixed: false unsigned: false primary: true autoincrement: true blog_id: type: integer(8) fixed: false user_id: type: integer(8) fixed: false question_title: type: string(255) I am using one join query for retrieving all the questions and user details from this two tables My join query is $q = Doctrine_Query::create() ->select('*') ->from('BlogQuestion u') ->leftJoin('u.UserDetails p'); $q->execute(); But it is showing this error Unknown relation alias UserDetails Pls anybody help me Thanks in advance

    Read the article

  • Doctrine CodeIgniter MySQL CRUD errors

    - by 01010011
    Hi, I am using CI + Doctrine + MySQL and I am getting the following CRUD errors: (1) When trying to create a new record in the database with this code: $book_title = 'The Peloponnesian War'; $b = new Book(); $b-title = $book_title; $b-price = 10.50; $b-save(); I get this error: Fatal error: Uncaught exeption 'Doctrine_Connection_Mysql_Exception' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'title' in 'field list' in ... (2) When trying to fetch a record from the database and display on my view page with this code: $book_title = 'The Peloponnesian War'; $title = $book_title; $search_results = Doctrine::getTable('Book')-findOneByTitle($title); echo $search_results-title; (in view file) I get this error: Fatal error: Uncaught exception 'Doctrine_Connection_Mysql_Exception' with message 'SQLSTATE[45S22]: Column not found: 1054 Unknown column 'b.id' in 'field list" in ... And finally, when I try to update a record as follows: $book_title = 'The Peloponnesian War'; $title = $book_title; $u = Doctrine::getTable('Book')-find($title); $u-title = $title; $u-save(); I get a similar error: Fatal error: Uncaught exception 'Doctrine_Connection_Mysql_Exception' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'b.id' in 'field list''in ... Here is my Doctrine_Record model: class Book extends Doctrine_Record{ public function setTableDefinition() { $this->hasColumn('book_id'); $this->hasColumn('isbn10','varchar',20); $this->hasColumn('isbn13','varchar',20); $this->hasColumn('title','varchar',100); $this->hasColumn('edition','varchar',20); $this->hasColumn('author_f_name','varchar',20); $this->hasColumn('author_m_name','varchar',20); $this->hasColumn('author_l_name','varchar',20); $this->hasColumn('cond','enum',null, array('values' => array('as new','very good','good','fair','poor'))); $this->hasColumn('price','decimal',8, array('scale' =>2)); $this->hasColumn('genre','varchar',20); } public function setUp() { $this->setTableName('Book'); //$this->actAs('Timestampable'); } Any assistance will be really appreciated. Thanks in advance.

    Read the article

  • Attching a Behaviour to a dynamically created table in Doctrine

    - by Cesare Contini
    How do I programmatically attach a Doctrine Behaviour programmatically to a table dynamically created through $conn->export->createTable('MyTable', $definition)? For example, if I have the following code: $definition = array( 'id' => array( 'type' => 'integer', 'primary' => true, 'autoincrement' => true ), 'name' => array( 'type' => 'string', 'length' => 255 ) ); $conn->export->createTable('MyTable', $definition) ; At this point I would need to attach a doctrine typical behaviour like Timestampable or Versionable to the newly created 'MyTable' table. Is it possible at all?

    Read the article

  • Doctrine: Multiple (whereIn OR whereIn) query?

    - by Tom
    I'm having trouble crafting a fairly simple query with Doctrine... I have two arrays ($countries, $cities) and I need to check whether database record values would match any inside either. I'm looking for something like: ->whereIn('country', 'city', $countries, $cities) ... with 'country' being a WHERE IN for $countries and 'city' being a WHERE IN for $city. I could separate the two out but the needed query has lots of other conditions so that's not possible. The resulting SQL I'm after would be: SELECT ... WHERE ... AND ... AND ... AND ('country' IN (1,2,3) OR 'city' IN (7,8,9)) AND ... AND ...; One could therefore think of it also as a bracketing issue only. Anyone know if this is possible with Doctrine DQL? I've looked through the documentation but can't find any direction. Thanks

    Read the article

  • 8 byte Integer with Doctrine and PHP

    - by Rufinus
    Hi, the players: 64bit linux with php 5 (ZendFramework 1.10.2) PostgreSQL 7.3 Doctrine 1.2 Via a Flash/Flex client i get an 8byte integer value. the field in the database is an BIGINT (8 byte) PHP_INT_SIZE show that system supports 8byte integer. printing out the value in the code as it is and as intval() leads to this: Plain: 1269452776100 intval: 1269452776099 float rounding failure ? but what really driving me nuts is ERROR: invalid input syntax for integer: "1269452776099.000000"' when i try to use it in a query. like: Doctrine_Core::getTable('table')->findBy('external_id',$external_id); or Doctrine_Core::getTable('table')->findBy('external_id',intval($external_id)); How i am supposed to handle this ? or how can i give doctrine a floating point number which it should use on a bigint field ? Any help is much appreciated! TIA

    Read the article

  • Unidirectional OneToMany in Doctrine 2

    - by darja
    I have two Doctrine entities looking like that: /** * @Entity * @Table(name = "Locales") */ class Locale { /** * @Id @Column(type="integer") * @GeneratedValue(strategy="IDENTITY") */ private $id; /** @Column(length=2, name="Name", type="string") */ private $code; } /** * @Entity * @Table(name = "localized") */ class LocalizedStrings { /** * @Id @Column(type="integer") * @GeneratedValue(strategy="IDENTITY") */ private $id; /** @Column(name="Locale", type="integer") */ private $locale; /** @Column(name="SomeText", type="string", length=300) */ private $someText; } I'd like to create reference between these entities. LocalizedStrings needs reference to Locale but Locale doesn't need reference to LocalizedStrings. How to write such mapping via Doctrine 2?

    Read the article

  • Doctrine Join DQL

    - by koko
    I's like to do a join between 2 tables on a specific ID. At the moment, I have this DQL: $q = Doctrine_Query::create() ->select('e.*, i.itemName, i.itemtypeId') ->from('Model_EventItem e') ->leftJoin('Model_Item i ON e.itemId = i.itemId') ->where('e.eventitemId = ?', $event->eventId) ->orderBy('i.itemName ASC'); The result is empty, although my eventId has a value ... Can you help me please? I there somewhere a tutorial on DQL-joins? I don't get it right with the help of the Doctrine documentation. Thanks! PS I have doctrine working in combination with Zend Framework.

    Read the article

  • Doctrine generate models - problem with relation type

    - by mrok
    I am trying generate doctrine models from yaml schema I have schema like that: Product: columns: id: type: integer(5) primary: true unsigned: true autoincrement: true activation_time: type: datetime notnull: true enduser_id: type: integer(5) unsigned: true notnull: true relations: Enduser: foreignType: one type: one foreignAlias: Product Hostid: columns: id: type: integer(5) primary: true unsigned: true autoincrement: true value: type: string(32) fixed: true notnull: true Order: columns: id: type: integer(5) primary: true autoincrement: true unsigned: true expire_date: type: datetime description: type: clob Enduser: columns: id: type: integer(5) primary: true unsigned: true autoincrement: true hostid_id: type: integer(5) unsigned: true notnull: true order_id: type: integer(5) unsigned: true notnull: true relations: Order: foreignAlias: Endusers Hostid: foreignAlias: Endusers and the problem is that models generated by doctrine generate-models-yaml are wrong in BaseEnduser $Product is defined as Doctrine_Collection $this-hasMany('Product', array( 'local' = 'id', 'foreign' = 'enduser_id')); instead just Product object what did I wrong? relation is defined as foreignType: one type: one

    Read the article

  • problem with doctrine:build-schema

    - by Ying
    Hi, im using symfony with doctrine, and Im trying to generate the schema yml file from a db. I get an this error SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'group' at line 1. Failing Query: "DESCRIBE group"I have a table named group in my database, and I suspect that this is screwing it up. Its not access problems as ive checked my db previleges. Any suggestions on what I can do? I have tried the quote-identifier attribute but with no luck : ( Im also struggling to find some good doctrine documentation. i cant seem to find where a list of attributes are, say for a creating a column in the schema.yml file. I tried reaching out to symfony forums but they are not responsive! Any help would be greatly appreciated! Thanks..

    Read the article

  • How to delete refClass record in Doctrine?

    - by terrani
    Hi all! I have many-to-many relations with the following tables. post tag post_tag I created three classes with Doctrine, so I have the following classes as well. BasePost BaseTag BasePostTag in the setUp() method, I defined relations. I like to delete tag record when I delete post record. So I simply put cascade as descirbed on Doctrine document. $this->hasMany("Tag as Tags",array( 'refClass' => 'PostTag', 'local'=>'object_id', 'foreign'=>'tag_id', 'cascade'=> array('delete') )); it works without a problem. My questions is, how do I delete a record from post_tag table? Do I need to create a query myself?

    Read the article

  • Mysql_insert_id with Doctrine

    - by Industrial
    Hi! I have a couple of tables (mySQL) that i would like to update with the help of Doctrine. The products table id is auto-incrementing, and here's a brief description on what I would like to do: $prod = new Products(); $prod->type = '0'; $categ = new CategoriesToProducts(); $categ->cat = '111'; $categ->product = $prod->id; $conn = Doctrine_Manager::connection(); $conn->flush(); How can I do this while using flush? Using a regular save is an alternative, but there will be multiple transactions while doing such. I have tried to find a Mysql_insert_id version for doctrine, but without any luck. Thanks!

    Read the article

  • PHP Doctrine 1.2 table names

    - by Ofir
    I'm trying to upgrade my doctrine ORM from 1.1.6 to 1.2.1 but i've enountered a BC issue with table names. Some of my table names have several words (e.g. t_foo_bar for class FooBar) where the t_ prefix is generated automatically with: $manager->setAttribute(Doctrine_Core::ATTR_TBLNAME_FORMAT, 't_%s'); This worked well in previous versions. In 1.2.1 however, it looks like doctrine is looking for t_foobar (instead of t_foo_bar with an underscore). Do you know how to solve this without changing the table names?

    Read the article

  • help with generating models from database for many to many in doctrine

    - by ajsie
    im using doctrine and i have set up some test tables to be generated into models: I want a many-to-many relationship models (3 tables converted into 3 models) (things are simplified to make the point clear) mysql tables: user: id INT // primary key name VARCHAR group: id INT // primary key name VARCHAR user_group: user_id INT // primary and foreign key to user.id group_id INT // primary and foreign key to group.id i thought that it would generate these models (from the documentation): // User.php class User extends Doctrine_Record { public function setTableDefinition() { $this->hasColumn('id'); $this->hasColumn('name); } public function setUp() { $this->hasMany('Group as Groups', array( 'refClass' => 'UserGroup', 'local' => 'user_id', 'foreign' => 'group_id' ) ); } } // Group.php class Group extends Doctrine_Record { public function setTableDefinition() { $this->hasColumn('id'); $this->hasColumn('name); } public function setUp() { $this->hasMany('User as Users', array( 'refClass' => 'UserGroup', 'local' => 'group_id', 'foreign' => 'user_id' ) ); } } // UserGroup.php class UserGroup extends Doctrine_Record { public function setTableDefinition() { $this->hasColumn('user_id') ); $this->hasColumn('group_id') ); } } but it generated this: // User.php abstract class BaseUser extends Doctrine_Record { public function setTableDefinition() { $this->hasColumn('id'); $this->hasColumn('name'); } public function setUp() { $this->hasMany('UserGroup', array( 'local' => 'id', 'foreign' => 'user_id')); } } // Group.php abstract class BaseGroup extends Doctrine_Record { public function setTableDefinition() { $this->hasColumn('id'); $this->hasColumn('name'); } public function setUp() { $this->hasMany('UserGroup', array( 'local' => 'id', 'foreign' => 'group_id')); } } // UserGroup.php abstract class BaseUserGroup extends Doctrine_Record { public function setTableDefinition() { $this->hasColumn('user_id'); $this->hasColumn('group_id'); } public function setUp() { $this->hasOne('User', array( 'local' => 'user_id', 'foreign' => 'id')); $this->hasOne('Group', array( 'local' => 'group_id', 'foreign' => 'id')); } } as you can see, there is no 'refClass' in the 'User' and 'Group' models pointing to the 'UserGroup'. the 'UserGroup' table in this case is just another table from Doctrine's perspective not a reference table. I've checked my table definitions in mysql. They are correct. user_group has 2 columns (primary keys and foreign keys), each one pointing to the primary key in either User or Group. But i want the standard many-to-many relationship models in Doctrine models. I'd appreciate some help. I have struggled to figure it out for a half day now. What is wrong? Thanks!

    Read the article

  • Doctrine: textarea line breaks & nl2br

    - by Tom
    Hi, I'm pulling my hair out with something that should be very simple: getting line breaks to show up properly in text that's returned from the database with Doctrine 1.2 I'm saving a message: $body = [text from a form textarea]; $m = new Message(); $m->setSubject($subject); $m->setBody($body); $m->save(); Querying the message: $q = Doctrine_Query::create() ->from('Message m') ->where('m.message_id = ?', $id) ->limit(1); $this->message = $q->execute(array(), Doctrine_Core::HYDRATE_ARRAY); In my template: echo $message[0]['body'] ... outputs the text without line breaks echo ln2br($message[0]['body']) ... no difference ... and I've tried every combination I could think of. Is Doctrine doing something to line breaks that's affecting this, or is there something that I'm just missing? Any help would be appreciated. Thanks.

    Read the article

  • proper way of setting an attribute in Doctrine?

    - by ajsie
    in some tutorials they tell you to set up an attribute like this: $manager = Doctrine_Manager::getInstance(); Doctrine_Manager::getInstance()->setAttribute( Doctrine::ATTR_AUTO_ACCESSOR_OVERRIDE, true); and in the documentation it shows you this: $manager = Doctrine_Manager::getInstance(); $manager->setAttribute( Doctrine::ATTR_AUTO_ACCESSOR_OVERRIDE, true); i wonder which one i should use? isn't it the latter one? cause how can you set an attribute to a singleton class in the first one? isn't the second one more correct?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >