Search Results

Search found 904 results on 37 pages for 'doctrine behaviors'.

Page 7/37 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • How can I handle this kind of exceptions (in Doctrine)

    - by ppavlovic
    Can you tell me how can I handle this kind of exceptions: Fatal error: Uncaught exception 'Doctrine_Connection_Exception' with message 'PDO Connection Error: SQLSTATE[HY000] [2013] Lost connection to MySQL server at 'reading initial communication packet', system error: 110' in ... It happens when connection with MySQL is lost during query. I need to handle this exception so I can show 500 error page so the crawlers do not cache page, and to redirect user to appropriate "Try again" page. P.S. I have a lot's of code, so I can not go trough all code to put try/catch block. I need something simple and yet effective.

    Read the article

  • What's the best way to paginate a dataset with Zend_Framework and Doctrine?

    - by joedevon
    Before I start to build this myself I thought I'd ask others to share their experience. What's the best / your favorite way to paginate a dataset with an application built upon Zend_Framework and Doctrine as your ORM? I'm new to Doctrine. I'm calling the model directly from a View Helper, bypassing the Controller, although I'm still interested if your solution uses controllers. I did see one article on this topic: http://ciaranmcnulty.com/blog/2009/06/Simplify-pagination-logic-using-a-custom-zend-paginator-adapter Devzone has an article using Doctrine, Zend Framework OR Pear, but none of those options mention a #ZF app that uses Doctrine.

    Read the article

  • PHP Doctrine: cannot find ClassName, but factory loading works..?

    - by ropstah
    I'm using PHP Doctrine and i've setup autoloading: spl_autoload_register(array('Doctrine', 'autoload')); spl_autoload_register(array('Doctrine', 'modelsAutoload')); I can create a table like so: $table = Doctrine_Core::getTable('TableName'); However if I try it like this, it doesn't work, what am I missing?: $table = new TableNameTable(); //Yes it should be TableNameTable

    Read the article

  • Doctrine MYSQL 150+ tables: generating models works, but not vice-versa?

    - by ropstah
    I can generate my models and schema.yml file based on an existing database. But when I try to do it the other way around using Doctrine::createTablesFromModels() i get an error: Syntax error or access violation: 1064 So either of these works: Doctrine::generateYamlFromDb(APPPATH . 'models/yaml'); Doctrine::generateYamlFromModels(APPPATH . 'models/yaml', APPPATH . 'models'); Doctrine::generateModelsFromYaml(APPPATH . 'models/yaml', APPPATH . 'models', array('generateTableClasses' => true)); Doctrine::generateModelsFromDb(APPATH . 'models', array('default'), array('generateTableClasses' => true)); But this fails (it drops/creates the database and around 50 tables): Doctrine::dropDatabases(); Doctrine::createDatabases(); Doctrine::createTablesFromModels(); The partially outputted SQL query shows that the error is around the Notification object which looks like this: Any leads would be highly appreciated! <?php // Connection Component Binding Doctrine_Manager::getInstance()->bindComponent('Notification', 'default'); /** * BaseNotification * * This class has been auto-generated by the Doctrine ORM Framework * * @property integer $n_auto_key * @property integer $type * @property string $title * @property string $message * @property timestamp $entry_date * @property timestamp $update_date * @property integer $u_auto_key * @property integer $c_auto_key * @property integer $ub_auto_key * @property integer $o_auto_key * @property integer $notified * @property integer $read * @property integer $urgence * * @package ##PACKAGE## * @subpackage ##SUBPACKAGE## * @author ##NAME## <##EMAIL##> * @version SVN: $Id: Builder.php 6820 2009-11-30 17:27:49Z jwage $ */ abstract class BaseNotification extends Doctrine_Record { public function setTableDefinition() { $this->setTableName('Notification'); $this->hasColumn('n_auto_key', 'integer', 4, array( 'type' => 'integer', 'fixed' => 0, 'unsigned' => false, 'primary' => true, 'autoincrement' => true, 'length' => '4', )); $this->hasColumn('type', 'integer', 1, array( 'type' => 'integer', 'fixed' => 0, 'unsigned' => false, 'primary' => false, 'notnull' => true, 'autoincrement' => false, 'length' => '1', )); $this->hasColumn('title', 'string', 50, array( 'type' => 'string', 'fixed' => 0, 'unsigned' => false, 'primary' => false, 'notnull' => true, 'autoincrement' => false, 'length' => '50', )); $this->hasColumn('message', 'string', null, array( 'type' => 'string', 'fixed' => 0, 'unsigned' => false, 'primary' => false, 'notnull' => true, 'autoincrement' => false, 'length' => '', )); $this->hasColumn('entry_date', 'timestamp', 25, array( 'type' => 'timestamp', 'fixed' => 0, 'unsigned' => false, 'primary' => false, 'notnull' => true, 'autoincrement' => false, 'length' => '25', )); $this->hasColumn('update_date', 'timestamp', 25, array( 'type' => 'timestamp', 'fixed' => 0, 'unsigned' => false, 'primary' => false, 'notnull' => false, 'autoincrement' => false, 'length' => '25', )); $this->hasColumn('u_auto_key', 'integer', 4, array( 'type' => 'integer', 'fixed' => 0, 'unsigned' => false, 'primary' => false, 'notnull' => true, 'autoincrement' => false, 'length' => '4', )); $this->hasColumn('c_auto_key', 'integer', 4, array( 'type' => 'integer', 'fixed' => 0, 'unsigned' => false, 'primary' => false, 'notnull' => false, 'autoincrement' => false, 'length' => '4', )); $this->hasColumn('ub_auto_key', 'integer', 4, array( 'type' => 'integer', 'fixed' => 0, 'unsigned' => false, 'primary' => false, 'notnull' => false, 'autoincrement' => false, 'length' => '4', )); $this->hasColumn('o_auto_key', 'integer', 4, array( 'type' => 'integer', 'fixed' => 0, 'unsigned' => false, 'primary' => false, 'notnull' => false, 'autoincrement' => false, 'length' => '4', )); $this->hasColumn('notified', 'integer', 1, array( 'type' => 'integer', 'fixed' => 0, 'unsigned' => false, 'primary' => false, 'default' => '0', 'notnull' => true, 'autoincrement' => false, 'length' => '1', )); $this->hasColumn('read', 'integer', 1, array( 'type' => 'integer', 'fixed' => 0, 'unsigned' => false, 'primary' => false, 'default' => '0', 'notnull' => true, 'autoincrement' => false, 'length' => '1', )); $this->hasColumn('urgence', 'integer', 1, array( 'type' => 'integer', 'fixed' => 0, 'unsigned' => false, 'primary' => false, 'default' => '0', 'notnull' => true, 'autoincrement' => false, 'length' => '1', )); } public function setUp() { parent::setUp(); } }

    Read the article

  • Does Doctrine 1.2 support importing indexes with Doctrine_Core::generateModelsFromDb function?

    - by Coagulant
    Does Doctrine 1.2 support importing indexes with Doctrine_Core::generateModelsFromDb() function? I need to make a migration between 2 database connections, one of them having unique index on 2 fields and one doesn't. And my migration is empty. It looks like Doctrine doesn't support indexes when importing from databae, other than those tied to relationship foreign keys. $changes = Doctrine_Core::generateMigrationsFromDiff($migrationsPath, array('doctrineOld'), array('doctrine'));

    Read the article

  • Behaviors in Blend 4 (Silverlight TV #30)

    Thanks to all of you, last week we flew past 1,000,000 views of Silverlight TV! Were not stopping here, we have a ton in store for the second half of the year. But first, a quick thank you to all of you for tuning in and for all of our great guests who have brought their A-game to the show and helped make Silverlight TV the * most popular Silverlight show on the internet ;-) * disclaimer: I have totally not researched that ;-) Now back to this weeks episode which Adam looks very excited about!...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • How do i use findAll method with a class in Doctrine?

    - by terrani
    Hi, I am a little bit confused with Doctrine class. I created a class and its base class in Doctrine. The class's name is User. so..I created an object of class User. $oUser = new User(); when I try to use findAll method, it does not work. I found the following code on the doctrine documentation. Doctrine_Core::getTable('User')-findAll(); I don't understand why i need to call getTable to use findAll method when I have User class. Am I missing something?

    Read the article

  • Doctrine Mssql uniqueidentifier isn't cast as char or nvarchar when retrieved from the database.

    - by Tres
    When I retrieve a record from the database which has a column of type "uniqueidentifier", Doctrine fills it with "null" rather than the unique id from the database. Some research and testing has brought this down to a PDO/dblib driver issue. When directly querying via PDO, null is returned in place of the unique id. For reference, http://trac.doctrine-project.org/ticket/1096, has a bit on this, however, it was updated 11 months ago with no comment for resolution. A way around this, as mentioned at http://bugs.php.net/bug.php?id=24752&edit=1, is to cast the column as a char. However, it doesn't seem Doctrine exposes the native field type outside of generating models which makes it a bit hard to detect uniqueidentifier types and cast them internally when building the sql query. Has anyone found a workaround for this?

    Read the article

  • Doctrine: Mixing YAML markup and db manager (navicat) editing?

    - by ropstah
    I think the answer to this question should be: No. However I hope to be corrected. I'd like to edit our database using a mixture of YAML markup + Doctrine createTables() and Navicat editing. Can I maintain the inheritance which is marked up? Example (4 steps, at step 4, Doctrine is in no way able to re-create the inheritance schema... or is it?): Step 1: Create YAML with inheritance --- Entity: columns: username: string(20) password: string(16) created_at: timestamp updated_at: timestamp User: inheritance: extends: Entity type: column_aggregation keyField: type keyValue: 1 Group: inheritance: extends: Entity type: column_aggregation keyField: type keyValue: 2 Step 2: Create tables using Doctrine (and drop/create db if nessecary) Created sql: CREATE TABLE entity (id BIGINT AUTO_INCREMENT, username VARCHAR(20), password VARCHAR(16), created_at DATETIME, updated_at DATETIME, type VARCHAR(255), PRIMARY KEY(id)) ENGINE = INNODB Step 3: Edit table using Navicat Step 4: Refresh YAML file because of 'external' edits...

    Read the article

  • How to delete many-to-many records in Doctrine?

    - by terrani
    Hi All, I am trying to delete records in many to many using Doctrine. I used code on http://www.doctrine-project.org/documentation/manual/1_2/ru/working-with-models#many-to-many-relations:deleting-a-link when I do the first method, it just deletes UserGroup record ONLY. How do I delete User, Group, and UserGroup records at once? The second and thrid methods do not work as well.

    Read the article

  • Obsessive behaviors in sysadmins

    - by squillman
    I have been told by colleagues (mainly non-technical) that some of my admin behaviors border on / cross the line between normal and obsessive, which sometimes leads me to wonder how screwed up I really am (read "how screwed up everyone else really is"). What are your obsessive behaviors when it comes to your sysadmin tasks and job functions? What do you do religiously that would make you twitch if you didn't do it or that others just roll their eyes at? I have reasons for my actions. I want to prove to my coworkers that I'm not alone.

    Read the article

  • KnpLabs / DoctrineBehaviors Translatable - currentLocale = null

    - by Ruben
    Using the trait \Knp\DoctrineBehaviors\Model\Translatable\Translation inside an Entity, I see that the property currentLocale is never setted , so we always obtain the default locale ('en') in all the calls to $this->translate(). If I change this getDefaultLocale, all the translations are made correctly, so I think that is no problem with the fallback. I tried debug the currentLocaleCallable. I see that if I put a "var_dump ($this-container-get('request'));" in the contructor of currentLocaleCallable, the request have a locale to null. And outside the request has the correct locale.It seems that container is not in the scope: request , i don't know how can I get it to work I post an issue in github https://github.com/KnpLabs/DoctrineBehaviors/issues/71 EDITED This service is defined in vendor/knplabs/doctrine-behaviors/config/orm-services.yml and is: knp.doctrine_behaviors.reflection.class_analyzer: class: "%knp.doctrine_behaviors.reflection.class_analyzer.class%" public: false knp.doctrine_behaviors.translatable_listener: class: "%knp.doctrine_behaviors.translatable_listener.class%" public: false arguments: - "@knp.doctrine_behaviors.reflection.class_analyzer" - "%knp.doctrine_behaviors.reflection.is_recursive%" - "@knp.doctrine_behaviors.translatable_listener.current_locale_callable" tags: - { name: doctrine.event_subscriber } knp.doctrine_behaviors.translatable_listener.current_locale_callable: class: "%knp.doctrine_behaviors.translatable_listener.current_locale_callable.class%" arguments: - "@service_container" # lazy request resolution public: false EDIT 2: My composer.json "php": ">=5.3.3", "symfony/symfony": "2.3.*", "doctrine/orm": ">=2.2.3,<2.4-dev", "doctrine/doctrine-bundle": "1.2.*", "twig/extensions": "1.0.*", "symfony/assetic-bundle": "2.3.*", "symfony/swiftmailer-bundle": "2.3.*", "symfony/monolog-bundle": "2.3.*", "sensio/distribution-bundle": "2.3.*", "sensio/framework-extra-bundle": "2.3.*", "sensio/generator-bundle": "2.3.*", "incenteev/composer-parameter-handler": "~2.0", "friendsofsymfony/user-bundle": "1.3.*", "avalanche123/imagine-bundle": "v2.1", "raulfraile/ladybug-bundle": "~1.0", "genemu/form-bundle": "2.2.*", "friendsofsymfony/rest-bundle": "0.12.0", "stof/doctrine-extensions-bundle": "dev-master", "sonata-project/admin-bundle": "dev-master", "a2lix/translation-form-bundle": "1.*@dev", "sonata-project/user-bundle": "dev-master", "psliwa/pdf-bundle": "dev-master", "jms/serializer-bundle": "dev-master", "jms/di-extra-bundle": "dev-master", "knplabs/doctrine-behaviors": "dev-master", "sonata-project/doctrine-orm-admin-bundle": "dev-master", "knplabs/knp-paginator-bundle": "dev-master", "friendsofsymfony/jsrouting-bundle": "~1.1", "zendframework/zend-validator": ">=2.0.0-rc2", "zendframework/zend-barcode": ">=2.0.0-rc2"

    Read the article

  • In symfony/doctrine's schema.yml, where should I put onDelete: CASCADE for a many-to-many relationsh

    - by nselikoff
    I have a many-to-many relationship defined in my Symfony (using doctrine) project between Orders and Upgrades (an Order can be associated with zero or more Upgrades, and an Upgrade can apply to zero or more Orders). # schema.yml Order: columns: order_id: {...} relations: Upgrades: class: Upgrade local: order_id foreign: upgrade_id refClass: OrderUpgrade Upgrade: columns: upgrade_id: {...} relations: Orders: class: Order local: upgrade_id foreign: order_id refClass: OrderUpgrade OrderUpgrade: columns: order_id: {...} upgrade_id: {...} I want to set up delete cascade behavior so that if I delete an Order or an Upgrade, all of the related OrderUpgrades are deleted. Where do I put onDelete: CASCADE? Usually I would put it at the end of the relations section, but that would seem to imply in this case that deleting Orders would cascade to delete Upgrades. Is Symfony + Doctrine smart enough to know what I'm wanting if I put onDelete: CASCADE in the above relations sections of schema.yml?

    Read the article

  • Symfony 1.4/ Doctrine; n-m relation data cannot be accessed in template (indexSuccess)

    - by chandimak
    I have a database with 3 tables. It's a simple n-m relationship. Student, Course and StudentHasCourse to handle n-m relationship. I post the schema.yml for reference, but it would not be really necessary. Course: connection: doctrine tableName: course columns: id: type: integer(4) fixed: false unsigned: false primary: true autoincrement: false name: type: string(45) fixed: false unsigned: false primary: false notnull: false autoincrement: false relations: StudentHasCourse: local: id foreign: course_id type: many Student: connection: doctrine tableName: student columns: id: type: integer(4) fixed: false unsigned: false primary: true autoincrement: false registration_details: type: string(45) fixed: false unsigned: false primary: false notnull: false autoincrement: false name: type: string(30) fixed: false unsigned: false primary: false notnull: false autoincrement: false relations: StudentHasCourse: local: id foreign: student_id type: many StudentHasCourse: connection: doctrine tableName: student_has_course columns: student_id: type: integer(4) fixed: false unsigned: false primary: true autoincrement: false course_id: type: integer(4) fixed: false unsigned: false primary: true autoincrement: false result: type: string(1) fixed: true unsigned: false primary: false notnull: false autoincrement: false relations: Course: local: course_id foreign: id type: one Student: local: student_id foreign: id type: one Then, I get data from tables in executeIndex() from the following query. $q_info = Doctrine_Query::create() ->select('s.*, shc.*, c.*') ->from('Student s') ->leftJoin('s.StudentHasCourse shc') ->leftJoin('shc.Course c') ->where('c.id = 1'); $this->infos = $q_info->execute(); Then I access data by looping through in indexSuccess.php. But, in indexSuccess I can only access data from the table Student. <?php foreach ($infos as $info): ?> <?php echo $info->getId(); ?> <?php echo $info->getName(); ?> <?php endforeach; ?> I expected, that I could access StudentHasCourse data and Course data like the following. But, it generates an error. <?php echo $info->getStudentHasCourse()->getResult()?> <?php echo $info->getStudentHasCourse()->getCourse()->getName()?> The first statement gives a warning; Warning: call_user_func_array() expects parameter 1 to be a valid callback, class 'Doctrine_Collection' does not have a method 'getCourse' in D:\wamp\bin\php\php5.3.5\PEAR\pear\symfony\escaper\sfOutputEscaperObjectDecorator.class.php on line 64 And the second statement gives the above warning and the following error; Fatal error: Call to a member function getName() on a non-object in D:\wamp\www\sam\test_doc_1\apps\frontend\modules\registration\templates\indexSuccess.php on line 5 When I check the query from the Debug toolbar it appears as following and it gives all data I want. SELECT s.id AS s__id, s.registration_details AS s__registration_details, s.name AS s__name, s2.student_id AS s2__student_id, s2.course_id AS s2__course_id, s2.result AS s2__result, c.id AS c__id, c.name AS c__name FROM student s LEFT JOIN student_has_course s2 ON s.id = s2.student_id LEFT JOIN course c ON s2.course_id = c.id WHERE (c.id = 1) Though the question is short, as all the information mentioned it became so long. It's highly appreciated if someone can help me out to solve this. What I require is to access the data from StudentHasCourse and Course. If those data cannot be accessed by this design and this query, any other methodology is also appreciated.

    Read the article

  • Automatically calling OnDetaching() for Silverlight Behaviors

    - by Dan Auclair
    I am using several Blend behaviors and triggers on a silverlight control. I am wondering if there is any mechanism for automatically detaching or ensuring that OnDetaching() is called for a behavior or trigger when the control is no longer being used (i.e. removed from the visual tree). My problem is that there is a managed memory leak with the control because of one of the behaviors. The behavior subscribes to an event on some long-lived object in the OnAttached() override and should be unsubscribing to that event in the OnDetaching() override so that it can become a candidate for garbage collection. However, OnDetaching() never seems to be getting called when I remove the control from the visual tree... the only way I can get it to happen is by explicit detaching the behavior BEFORE removing the control and then it is properly garbage collected. Right now my only solution was to create a public method in the code-behind for the control that can go through and detach any known behaviors that would cause garbage collection problems. It would be up to the client code to know to call this before removing the control from the panel. I don't really like this approach, so I am looking for some automatic way of doing this that I am overlooking or a better suggestion. public void DetachBehaviors() { foreach (var behavior in Interaction.GetBehaviors(this.LayoutRoot)) { behavior.Detach(); } //... //continue detaching all known problematic behaviors.... }

    Read the article

  • Problem adding a behaviors element to my WCF client config

    - by SteveChadbourne
    I'm trying to add a behaviors element to my client config file so I can specify maxItemsInObjectGraph. The error I get is: The element 'system.serviceModel' has invalid child element 'behaviors'. List of possible elements expected: 'bindings, client, extensions'. Here is my config: <configuration> <system.serviceModel> <bindings> <basicHttpBinding> <binding name="BasicHttpBinding_KernService" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"> <security mode="None" /> </binding> </basicHttpBinding> </bindings> <behaviors> <endpointBehaviors> <behavior name="ServiceViewEventBehavior"> <dataContractSerializer maxItemsInObjectGraph="2147483647"/> </behavior> </endpointBehaviors> </behaviors> <client> <endpoint address="http://localhost/KernMobile.WCF/KernService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_KernService" contract="KernWcfService.KernService" name="BasicHttpBinding_KernService" behaviorConfiguration="ServiceViewEventBehavior" /> </client> </system.serviceModel> </configuration> It's also complaining about the behaviorConfiguration attribute in the endpoint element. Any ideas? .Net 4.0 BTW.

    Read the article

  • How do I sort an internationalized i18n table with symfony and doctrine?

    - by Maurizio
    I would like to display a list of records from an internationalized table using sfDoctrinePager. Not all the records have been translated to all the languages supported by the application, so I had to implement a fallback mechanism for some fields (by overriding the getFoo() function in the Bar.class.php, as explained in another post here). I have different fallback list for each culture. Everything works fine until when it comes to sorting the records in alphabetical order. I'm sorting the records at the SQL (Dql) level, by adding an -orderBy('t.name') to the query: $q = Doctrine::getTable('Foo') ->createQuery('f') ->leftJoin('f.Translation t') ->orderBy('t.name') But here come the troubles: the list gets not sorted correctly, regardless of the active culture. I get rather better results when I limit the translations to the active culture, like this: ->leftJoin('f.Translation t WITH lang = ?', $request->getParameter('sf_culture'); Then the sorting is correct, as far as all the translations exist for the active culture. If a translation does not exist and I have to take the name from the fallback language, the record will be displayed at the very beginning of the list (I understand this happens because the value for the current culture is null). My question is: is there a best practice for getting internationalized fields (needing fallbacks) sorted correctly with doctrine and sfDoctrinePager? Thank you in advance.

    Read the article

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