doctrine-orm

I need to put SQL native in query Builder Doctrine2

一世执手 提交于 2020-01-14 19:06:31
问题 i need to work with SQL NATIVE in query Builder doctrine 2 for using SQL Function (CONCAT,REPLACE,LDAP) . please Help me. 回答1: You may try : $connection = $this->get('doctrine')->getConnection(); $toto = "toto"; $foo = "foo"; $params = array('param1' => $toto, 'param2' => $foo); $request = "SELECT * FROM table WHERE param1 = :param1 AND param2 = :param2"; try { $stmt = $connection->executeQuery($request, $params); } catch (\PDOException $e) { // echo $e->getMessage(); } while (($result =

Symfony getting all field names from database table

徘徊边缘 提交于 2020-01-14 13:05:28
问题 I need to get all database table field names. I've already tried getting that using ClassMetadata unfortunately getColumnNames() doesn't return relational field names. and method getAssociationNames() returns names of entity properties which are not the same names and also might include fields that doesn't really exist in database when using oneToMany relations. As people mentioned that this may be duplicate. It's not. Getting column names in a doctrine2 entity which might be a similar

there is no active transaction in catch rollback

岁酱吖の 提交于 2020-01-14 06:06:14
问题 I have read that I should use method Commit before persist, but that didn't solved my problem. I also try to use cancel EntityManager before rollback as well, but that didn't solved my problem too... $this->em->getConnection()->beginTransaction(); // suspend auto-commit if($out = $this->em->getConnection()->isTransactionActive()) { var_dump($out); } try { //... do some work $history = new PromocodeHistory(); $history->setCode($code); $history->setUser($this->getUser()); $this->em->persist(

there is no active transaction in catch rollback

时光怂恿深爱的人放手 提交于 2020-01-14 06:04:35
问题 I have read that I should use method Commit before persist, but that didn't solved my problem. I also try to use cancel EntityManager before rollback as well, but that didn't solved my problem too... $this->em->getConnection()->beginTransaction(); // suspend auto-commit if($out = $this->em->getConnection()->isTransactionActive()) { var_dump($out); } try { //... do some work $history = new PromocodeHistory(); $history->setCode($code); $history->setUser($this->getUser()); $this->em->persist(

ERD Modelling tool with Doctrine Support

三世轮回 提交于 2020-01-14 05:58:22
问题 I'm looking for a free or paid software application that I can use for ER modelling. Since I mostly develop applications using Symfony2/Doctrine, does anyone know about software that has Doctrine support? 回答1: I think the following comparison is what you're searching: http://www.orm-designer.com/article/orm-designer-and-mysql-workbench-comparison Conclusion: both ORM Designer and MySQL workbench are able to work with Doctrine. Since MySQL workbench is free and under the wings of MySQL itself

Sylius Product Bundle configuration

橙三吉。 提交于 2020-01-13 18:16:44
问题 I'm trying to integrate Sylius Product Bundle into my existing Symfony project. It already has doctrine configured. This is the error I am getting: [Symfony\Component\Config\Definition\Exception\InvalidConfigurationException] The child node "driver" at path "sylius_attribute" must be configured. Any idea what's causing this? I followed the instruction right off the bat without doing any other installations of sylius. http://docs.sylius.org/en/latest/bundles/SyliusProductBundle/installation

Doctrine 2 Pagination with Association Mapping

坚强是说给别人听的谎言 提交于 2020-01-13 13:50:32
问题 I am wondering how can you paginate the results obtained from an entity association mapping in Doctrine 2? For example class Customer { /** * @OneToMany(targetEntity="Order") */ private $orders; } can be used as such: $customer->getOrders(); which will return a collection of Order objects. The problem is when there are a large number of order objects. We can use Doctrine\ORM\Tools\Pagination\Paginator when building custom queries, however I do not see any way to hook into query generation

Connect to Multiple data bases using Zend Framework 2 and DoctrineORMModule

喜你入骨 提交于 2020-01-13 13:43:50
问题 Hello i'm using Zend Framework 2 and DoctrineORMModule. I need to access to different data bases connections and map two different set of schemas. 'doctrine' => array( 'connection' => array( 'orm_default' => array( 'driverClass' => 'Doctrine\DBAL\Driver\PDODblib\Driver', 'params' => array( 'host' => 'HOST', 'port' => '1433', 'user' => 'USER', 'password' => 'PASS', 'dbname' => 'DBNAME', ) ) ) ), ///////////// 'doctrine' => array( 'connection' => array( 'orm_default' => array( 'driverClass' =>

Doctrine DQL RIGHT JOIN?

ε祈祈猫儿з 提交于 2020-01-13 12:19:12
问题 Is it possible to do a RIGHT OUTER JOIN in Doctrine 2 DQL? 回答1: As far as I know, there is still no way to do that in DQL, and the reason might be that it does not make much sense from an ORM perspective, according to one of the lead developers. Nevertheless, the feature request, although very old, is still open; so it might be implemented in the future. 来源: https://stackoverflow.com/questions/7957987/doctrine-dql-right-join

Error showing when using Custom repository in Symfony 2?

二次信任 提交于 2020-01-13 10:26:12
问题 I am new to symfony 2. I am trying to use custom repository in symfony 2. After writing the function in the detailsRepository.php file. in the controller I wrote $em = $this->getDoctrine()->getEntityManager(); $products = $em->getRepository('BundlesampleBundle:details') ->findAllWhoseEmailContains($value); but i am getting the error as Warning: Missing argument 1 for Doctrine\ORM\EntityRepository::__construct(), called in C:\xampp\htdocs\symblog\src\Bundle\sampleBundle\Controller