Search Results

Search found 383 results on 16 pages for 'doctrine'.

Page 11/16 | < Previous Page | 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • generateUrl problem

    - by Daniel Hertz
    I am trying to generate a url but I keep getting a strange warning even though it works. I am making an api xml page and I use the following call in the controller: public function executeList(sfWebRequest $request) { $this->users = array(); foreach($this->getRoute()->getObjects() as $user) { $this->users[$this->generateUrl('user_show', $user, true)] = $user->asArray($request->getHost()); } } The user_show route is as follows: # api urls user_show: url: /user/:nickname param: { module: user, action: show } And the xml outputs as follows: <br /> <b>Warning</b>: array_diff_key() [<a href='function.array-diff-key'>function.array-diff-key</a>]: Argument #1 is not an array in <b>/opt/local/lib/php/symfony/routing/sfRoute.class.php</b> on line <b>253</b><br /> <br /> <b>Warning</b>: array_diff_key() [<a href='function.array-diff-key'>function.array-diff-key</a>]: Argument #1 is not an array in <b>/opt/local/lib/php/symfony/routing/sfRoute.class.php</b> on line <b>253</b><br /> <br /> <b>Warning</b>: array_diff_key() [<a href='function.array-diff-key'>function.array-diff-key</a>]: Argument #1 is not an array in <b>/opt/local/lib/php/symfony/routing/sfRoute.class.php</b> on line <b>253</b><br /> <?xml version="1.0" encoding="utf-8"?> <users> <user url="http://krowdd.dev/frontend_dev.php/user/danny"> <name>Danny tz</name> <nickname>danny</nickname> <email>[email protected]</email> <image></image> </user> <user url="http://krowdd.dev/frontend_dev.php/user/adrian"> <name>Adrian Sooian</name> <nickname>adrian</nickname> </user> </users> So it outputs the correct xml but I do not know why it throws thows warning when calling the generateurl method. Thanks!

    Read the article

  • Retrive unchanged data

    - by cnkt
    How can i get the Doctrine_Record's unchanged version of field data. For example; echo $user->username; // Prints 'David' $user->username = 'John'; echo $user->username; // Prints 'John' How to get the pre-changed value (David)?

    Read the article

  • Symfony FK Constraint Issue

    - by Daniel Hertz
    Hello! So I have a table schema that has users who can be friends. User: actAs: { Timestampable: ~ } columns: name: { type: string(255), notnull: true } email: { type: string(255), notnull: true, unique: true } nickname: { type: string(255), unique: true } password: { type: string(300), notnull: true } image: { type: string(255) } FriendsWith: actAs: { Timestampable: ~ } columns: friend1_id: { type: integer, primary: true } friend2_id: { type: integer, primary: true } relations: User: { onDelete: CASCADE, local: friend1_id, foreign: id } User: { onDelete: CASCADE, local: friend2_id, foreign: id } It builds the database correctly, but when I try to insert test data like: User: user1: name: Danny Gurt email: [email protected] nickname: danny password: test1 user2: name: Adrian Soian email: [email protected] nickname: adrian password: test1 FriendsWith: friendship1: friend1_id: user1 friend2_id: user2 I get this integrity constraint problem: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`krowdd`.`friends_with`, CONSTRAINT `friends_with_ibfk_1` FOREIGN KEY (`friend1_id`) REFERENCES `user` (`id`) ON DELETE CASCADE) Any ideas? Thanks!

    Read the article

  • Integrating OpenID into Symfony 1.4?

    - by Steve
    I've tried integrating sfPHPOpenIdPlugin but that hit a dead-end since it's built for Symfony 1.2 and relies on deprecated PHP functionality; I also had a go with sfGoogleLoginPlugin which did authenticate correctly but lacks extended capability to retrieve user details (+ would restrict me to Google; obviously). I'm thinking the most viable solution is to link in one of the various PHP libraries available into my model. I'm wondering if anyone else has had any success/tips with such an integration and what libraries to consider?

    Read the article

  • symfony get data from array

    - by iggnition
    Hi, I'm trying to use an SQL query to get data from my database into the template of a symfony project. my query: SQL: SELECT l.loc_id AS l__loc_id, l.naam AS l__naam, l.straat AS l__straat, l.huisnummer AS l__huisnummer, l.plaats AS l__plaats, l.postcode AS l__postcode, l.telefoon AS l__telefoon, l.opmerking AS l__opmerking, o.org_id AS o__org_id, o.naam AS o__naam FROM locatie l LEFT JOIN organisatie o ON l.org_id = o.org_id This is generated by this DQL: DQL: $this->q = Doctrine_Query::create() ->select('l.naam, o.naam, l.straat, l.huisnummer, l.plaats, l.postcode, l.telefoon, l.opmerking') ->from('Locatie l') ->leftJoin('l.Organisatie o') ->execute(); But now when i try to acces this data in the template by either doing: <?php foreach ($q as $locatie): ?> <?php echo $locatie['o.naam'] ?> or <?php foreach ($q as $locatie): ?> <?php echo $locatie['o__naam'] ?> i get the error from symfony: 500 | Internal Server Error | Doctrine_Record_UnknownPropertyException Unknown record property / related component "o__naam" on "Locatie" Does anyone know what is going wrong here? i dont know how to call the value from the array if the names in both query's dont work.

    Read the article

  • Symfony fk issue on insertion

    - by Daniel Hertz
    Hi, I posted a similar problem but it could not be resolved. I create a relational database of users and groups but for some reason I cannot insert test data with fixtures properly. Here is a sample of the schema: User: actAs: { Timestampable: ~ } columns: name: { type: string(255), notnull: true } email: { type: string(255), notnull: true, unique: true } nickname: { type: string(255), unique: true } password: { type: string(300), notnull: true } image: { type: string(255) } Group: actAs: { Timestampable: ~ } columns: name: { type: string(500), notnull: true } image: { type: string(255) } type: { type: string(255), notnull: true } created_by_id: { type: integer } relations: User: { onDelete: SET NULL, class: User, local: created_by_id, foreign: id, foreignAlias: groups_created } FanOf: actAs: { Timestampable: ~ } columns: user_id: { type: integer, primary: true } group_id: { type: integer, primary: true } relations: User: { onDelete: CASCADE, local: user_id, foreign: id, foreignAlias: fanhood } Group: { onDelete: CASCADE, local: group_id, foreign: id, foreignAlias: fanhood } And this is the data i try to input: User: user1: name: Danny email: [email protected] nickname: danny password: f05050400c5e586fa6629ef497be Group: group1: name: Mets type: sports FanOf: fans1: user_id: user1 group_id: group1 I keep getting this error: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`krowdd`.`fan_of`, CONSTRAINT `fan_of_user_id_user_id` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE) The users and groups are clearly being created before the "fanhood" is so why am I getting this error?? Thanks!

    Read the article

  • Symfony sfDoctrinePager with multiple tables

    - by Zoja
    I was wondering how to get this to run. In my application I have a Category table and Product table. I need to have a pager which combines both Categories and Products for display in one list (first categories then products). Is there a way to get this going ? I tried left joining in the pager's query, but doesn't seem to do the trick.

    Read the article

  • How active record is automatically setting up the autoincremental value of ID?

    - by piemesons
    Here this is what we are doing:-- an_order = Order.new an_order.name = "Dave Thomas" an_order.email = "[email protected]" an_order.address = "123 Main St" an_order.pay_type = "check" an_order.save Now it will insert a new row in orders table right. I m having a ID column in that table. Now suppose after inserting this record the value of the ID corresponding to this record is 100. Now how this 100 value came to know? Does the previous value of ID ie 99 (Suppose) is stored somewhere in some variable/file in the ORM layer or before inserting this value a query was fired to know about the last inserted value or database is itself doing that or anything else???

    Read the article

  • Zend_Auth and database session SaveHandler

    - by takeshin
    I have created Zend_Auth adapter implementing Zend_Auth_Adapter_Interface (similar to Pádraic's adapter) and created simple ACL plugin. Everything works fine with default session handler. So far, so good. As a next step I have created custom Session SaveHandler to persist session data in the database. My implementation is very similar to this one from parables-demo. Seems that everything is working fine. Session data are properly saved to the database, session objects are serialized, but authentication does not work when I enable this custom SaveHandler. I have debugged the authentication and all works fine up till the next request, when the authentication data are lost. I suspected, that is has something to do with the fact, that I use $adapter->write($object) instead $adapter->write($string), but the same happens with strings. I'm bootstrapping Zend_Application_Resource_Session in the first Bootstrap method, as early as possible. Does Zend_Auth need any extra configuration to persist data in the database? Why the authentity is being lost?

    Read the article

  • Doctrine_Query update with float value

    - by YS-PRO
    I need to increment User's balance, so I do: Doctrine_Query::create()->from('User')->update('balance', 'balance + 0.15')->execute(); And I got an error "Unknown component alias 0". I think its because of 0.15 So how can I update (using DQL) balance without additional SELECT queries to User's table to fetch his balance, calculate new balance and do query like Doctrine_Query::create()->from('User')->update('balance', '?', $new_balance)->execute();

    Read the article

  • one table is shared between several websites

    - by sami
    I have a static table that's shared by several websites. By static, I mean that the data is read but never updated by the websites. Currently, all websites are served from the same server but that may change. I want to minimize the need for creating/maintaining this table for each of the websites, so I thought about turning it to an xml file that's stored in a shared library that all websites have access to. The problem is I use an ORM and use forign key constraints to ensure integrity of the ids used from that table, so by removing that table out of the MySQL database into an XML file, will this affect the integrity of the ids coming from that table? My table looks like this <table name="entry"> <column name="id" type="INTEGER" primaryKey="true" autoIncrement="true" /> <column name="title" type="VARCHAR" size="500" required="true" /> </table> and I use it as a foreign key in other tables <table name="refer"> <column name="id" type="INTEGER" primaryKey="true" autoIncrement="true" /> <column name="linkto" type="INTEGER"/> <foreign-key foreignTable="entry"> <reference local="linkto" foreign="id" /> </foreign-key> </table> So I'm wondering if I remove that table out of the database, is there a way to retain that referential integrity? And of course are these any other efficient ways to do the same thing? I just don't want to have to repeat that table for several websites.

    Read the article

  • Zend_Auth and database SaveHandler

    - by takeshin
    I have created Zend_Auth adapter implementing Zend_Auth_Adapter_Interface (similar to Pádraic's adapter) and created simple ACL plugin. Everything works fine with default session handler. So far, so good. As a next step I have created custom Session SaveHandler to persist session data in the database. My implementation is very similar to this one from parables-demo. Seems that everything is working fine. Session data are properly saved to the database, session objects are serialized, but authentication does not work when I enable this custom SaveHandler. I have debugged the authentication and all works fine up till the next request, when the authentication data are lost. I suspected, that is has something to do with the fact, that I use $adapter->write($object) instead $adapter->write($string), but the same happens with strings. I'm bootstrapping Zend_Application_Resource_Session in the first Bootstrap method, as early as possible. Does Zend_Auth need any extra configuration to persist data in the database? Why the authentity is being lost?

    Read the article

  • displaying values from join query array

    - by THOmas
    I have used a join query for retrieving value from two tables one is blogquestion and userdetails I wrote this query $this->questions = Doctrine_Query::create() ->select('b.question_id,b.user_id,b.question_title,b.question_tags,b.created_at,u.id,u.name') ->from('BlogQuestion b') ->leftJoin('b.UserDetails u') ->execute(); In the template iam displaying the result using a foreach <?php foreach($questions as $quest):?> echo $quest->getQuestionTitle() echo $quest->getQuestionTags() echo $quest->getName() <?php endforeach?> title is getting from the blogquestion table and name is in usredetails table iam getting the eerror Unknown record property / related component "name" on "BlogQuestion"

    Read the article

  • Calling overridden method from within overriding method in OO PHP

    - by paddymcc
    Working in a symfony model, I want to override a function and call the overridden function from within the overriding one, along the lines of class MyClass extends BaseMyClass { function setMyProperty($p) { parent::setMyProperty($p); //do some other stuff } } This is resulting in a segmentation fault. I don't want to alter the parent class - it's been generated by symfony, and may feasibly be overwritten in the future if the model is rebuilt. This seems like something that should be straightforward, but I'm struggling to find the solution. Thanks for any advice

    Read the article

  • Using virtual fields in Doctrine_Query

    - by James Maroney
    Is there a way to insert logic based on virtual fields into a Doctrine_Query? I have defined a virtual field in my model, "getStatus()" which I would ultimately like to utilize in a Where clause in my Doctrine_Query. ... ->AndWhere('x.status = ?',$status); "status", however, is not a column in the table it is instead computed by business logic in the model. Filtering the Collection after executing the query works in some situations, but not when a Doctrine_Pager is thrown in the mix, as it computes it's offsets and such before you have access to the Collection. Am I best off ditching Doctrine_Pager and rebuilding that functionality after modifying the Doctrine_Collection?

    Read the article

  • How can get unique values from data table using dql?

    - by piemesons
    I am having a table in which there is a column in which various values are stored.i want to retrieve unique values from that table using dql. Doctrine_Query::create() ->select('rec.school') ->from('Records rec') ->where("rec.city='$city' ") ->execute(); Now i want only unique values. Can anybody tell me how to do that... Edit Table Structure: CREATE TABLE IF NOT EXISTS `records` ( `id` int(11) NOT NULL AUTO_INCREMENT, `state` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `city` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `school` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=16334 ; This is the Query I am using: Doctrine_Query::create() ->select('DISTINCT rec.city') ->from('Records rec') ->where("rec.state = '$state'") // ->getSql(); ->execute(); Generting Sql for this gives me: SELECT DISTINCT r.id AS r__id, r.city AS r__city FROM records r WHERE r.state = 'AR' Now check the sql generated:::: DISTINCT is on 'id' column where as i want Distinct on city column. Anybody know how to fix this. EDIT2 Id is unique cause its an auto incremental value.Ya i have some real duplicates in city column like: Delhi and Delhi. Right.. Now when i am trying to fetch data from it, I am getting Delhi two times. How can i make query like this: select DISTINCT rec.city where state="xyz"; Cause this will give me the proper output. EDIT3: Anybody who can tell me how to figure out this query..???

    Read the article

  • How to apply query to model if field not filtered

    - by jdog
    I have a range of modules running on generator.yml. In some of those I would like to hide records by default of Status: CLOSED (being the last of a range of Statuses). OF course if the user filters for CLOSED i want to show these records. I thought it would make sense to apply andWhere('status_id=?',Status::CLOSED) in a specific table_method , but how do I access the filters of the module from within the model? Is there a better way to do this?

    Read the article

  • Tag suggestion (not tag autocomplete)

    - by takeshin
    AJAX autocomplete is fairly simple to implement. However, I wonder how to handle smart tag suggestion like this on SO. To clarify the difference between autocomplete and suggestion: autocomplete: foo [foobar, foobaz] suggestion: foo [barfoo, foobar, foobaz], or even better, with 'did you mean' feature: [barfoo, foobar, foobaz, fobar, fobaz] I suppose I need some full text search in tags (all letters indexed, not just words). There would be no problem to do it witch regex or other patterns for limited number of tags (even client side). But how to implement this feature for big number of tags? Is there any particular reason (besides URL) the tags on SO are dash separated? What about Unicode characters in tags? I store the tags in the table with the following columns: id, tagname. My SQL query returns objects with following fields: id, tagname, count

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16  | Next Page >