doctrine

How to use Doctrine OracleSessionInit listener with Symfony2?

∥☆過路亽.° 提交于 2020-01-01 01:53:15
问题 I am using oracle and I am recieving this error: Could not convert database value "17-NOV-11 12.17.33 AM" to Doctrine Type datetime. Expected format: Y-m-d H:i:s Also I can´t create new rows because oracle complaints about the datetime format. I know that mysql datetime format and oracle one are different. I understand that you can use doctrine listeners with symfony 2: http://symfony.com/doc/current/cookbook/doctrine/event_listeners_subscribers.html And, there´s a doctrine listener created

How to adapt modules ZfcUser/ zfcuserDoctrineORM in my project with doctrine 2 using annotations?

丶灬走出姿态 提交于 2020-01-01 00:48:10
问题 I’m writing from Argentina, forgive my English little. I’m having some problems with modules ZfcUser and zfcuserDoctrineORM . I need to integrate them into my project. I’m working with Zend framework 2 , doctrine 2.3 and postgreSQL and this is the first time I work with these tools. For that reason, there are many things that I don’t dominate well, I have all the modules included in my /config/application.config.php and my connection is configured in my database in /config/autoload/local.php

How to sort own columns in admin panel with symfony?

两盒软妹~` 提交于 2019-12-31 04:10:48
问题 M schema.yml: News: columns: title: type: string(50) category_id: type: integer(4) relations: Category: local: category_id foreign: category_id type: one Category: columns: category_name: type: string(50) generator: class: sfDoctrineGenerator param: model_class: News theme: admin non_verbose_templates: true with_show: false singular: ~ plural: ~ route_prefix: news with_doctrine_route: true actions_base_class: sfActions config: actions: ~ fields: ~ list: display: [news_id, title, category_name

“No mapped field” when using partial query and composite keys in Doctrine2

喜你入骨 提交于 2019-12-30 17:38:44
问题 I have two models called Person and Tag . One Person has many Tags, and the Tag primary key is a composite key of person_id and tag ( Person $person and $tag in Doctrine2). There is a data field ( BLOB ) in the Tag model with a lot of data. I am setting up a query that does not require the data from that field, so I want to set up a query that does not retrieve that field. I tried with the following query: SELECT c, PARTIAL t.{tag} FROM Contact c LEFT JOIN c.tags Here, I get the somewhat

“No mapped field” when using partial query and composite keys in Doctrine2

天涯浪子 提交于 2019-12-30 17:38:33
问题 I have two models called Person and Tag . One Person has many Tags, and the Tag primary key is a composite key of person_id and tag ( Person $person and $tag in Doctrine2). There is a data field ( BLOB ) in the Tag model with a lot of data. I am setting up a query that does not require the data from that field, so I want to set up a query that does not retrieve that field. I tried with the following query: SELECT c, PARTIAL t.{tag} FROM Contact c LEFT JOIN c.tags Here, I get the somewhat

Doctrine 2.0 ReflectionException when I try to do YAML Mapping

≡放荡痞女 提交于 2019-12-30 13:34:07
问题 I have in my cli-config.php this code: $driverImpl = new \Doctrine\ORM\Mapping\Driver\YamlDriver(array(__DIR__.'/yaml')); $driverImpl->setFileExtension('.yml'); $config->setMetadataDriverImpl($driverImpl); In ./yaml there are the yml files (Client.yml,Worker.yml,Company.yml) When i run the file to generate in db the schema with this instruccion: php doctrine orm:schema-tool:create throws: PHP Warning: class_parents(): Class Client does not exist and could not be loaded in applicationPath

SonataAdminBundle Exporter issue with mapped entities

北慕城南 提交于 2019-12-30 10:35:29
问题 There is a standard feature in sonata-admin-bundle to export data using exporter; But how to make export current entity AND mapped ManyToOne entity with it? Basically what I want, is to download exactly same data as defined in ListFields. UPD: In docs, there is only todo UPD2: I've found one solution, but I do not think it is the best one: /** * Add some fields from mapped entities; the simplest way; * @return array */ public function getExportFields() { $fieldsArray = $this->getModelManager(

How to query NOT NULL with Doctrine?

半腔热情 提交于 2019-12-30 07:55:47
问题 I have table Test: Test: id | name 1 | aaa 2 | 3 | ccc 4 | aaa 5 | 6 | ddd I want result where name is NOT NULL: aaa ccc aaa ddd How can i get with: Doctrine_Core::getTable('Test')->findBy('name', NOTNULL??) <-doesnt working and in model with: $this->createQuery('u') ->where('name = ?', NOTNULL ???) <- doesnt working ->execute(); 回答1: Try this: $this->createQuery('u') ->where('name IS NOT NULL') ->execute(); which is standard SQL syntax. Doctrine doesn't convert Null values into proper sql.

Symfony 3 connection to multiple databases

北慕城南 提交于 2019-12-30 07:02:00
问题 dynamic: driver: %database_driver% host: %database_host% port: %database_port% dbname: %database name% user: %database_user% password: %database_password% charset: UTF8 Hi everybody I would like to connect to multiple databases dynamically. I read this tutorial http://symfony.com/doc/current/cookbook/doctrine/multiple_entity_managers.html and it works as it was explained. But my only problem is to change the value of dbname directly from my Controller to connect to all my databases. It will

Doctrine merge: DateTime field always updated

风格不统一 提交于 2019-12-30 05:59:02
问题 I create a new Entity with an existing Id , and I want to update the related database record. Doctrine merge has been my best friend: recognizes if there are changes and generates the correct update query. $entity = new Entity(); $entity->setId(1); $entity->setName('test'); $EntityManager->merge($entity); $EntityManager->flush(); Suppose that the element with the id=1 already exists in the db: if the name is different from 'test', Doctrine generates this query: UPDATE table SET name = ? WHERE