doctrine

How do I use the cascade option in Symfony2 Doctrine?

你离开我真会死。 提交于 2019-12-21 03:29:12
问题 I'm trying to understand the cascade option in Doctrine in Symfony2 . I would like to be able to delete a child entity (and not trigger the foreign key constraint error.) I have 3 entities: Report /** * @ORM\OneToMany(targetEntity="Response", mappedBy="report") */ protected $responses; /** * @ORM\OneToMany(targetEntity="Response", mappedBy="report") */ protected $sms; Response /** * @ORM\ManyToOne(targetEntity="Report", inversedBy="responses") */ protected $report; SMS /** * @ORM\ManyToOne

Deprecation: Doctrine\ORM\Mapping\UnderscoreNamingStrategy without making it number aware is deprecated

蹲街弑〆低调 提交于 2019-12-21 03:09:19
问题 I'm using Symfony 4.3.8 and I can't find any information about thoses deprecations : User Deprecated: Creating Doctrine\ORM\Mapping\UnderscoreNamingStrategy without making it number aware is deprecated and will be removed in Doctrine ORM 3.0. Creating Doctrine\ORM\Mapping\UnderscoreNamingStrategy without making it number aware is deprecated and will be removed in Doctrine ORM 3.0. I searched in stacktrace and found this : class UnderscoreNamingStrategy implements NamingStrategy { private

symfony2 dynamic database connection using doctrine

寵の児 提交于 2019-12-21 02:51:36
问题 I am trying to have multiple database connection in Symfony 2 with doctrine but not able to do so. I have searched extensively in Google and stack-overflow but everywhere it's done via config.yml file or dynamic database where all DB's have same schema/entities . But for my case the database is determined based on subdomain and the database schema is not same for all subdomains. Ex: test1.example.com => Should load test1 db test2.example.com => Will load test2 db Both test1 and test2 DB are

ZF2 - BjyAuthorize - How to Get Rules and Guards from a Database

本秂侑毒 提交于 2019-12-21 02:34:15
问题 I'm using BjyAuthorize with Zend Framework2 to implement authorization and was able to successfully integrate roles from database. Now I want to get my Rules and Guards also from data base tables. How can I do this? 回答1: The easiest method and "the trick" here is really to: Get your rules and guards into the same array format as it is shown in example configuration. So after reading records from the database, in whatever format your raw database data is, process it to match the same guard

How can I inject doctrine into Symfony2 service

馋奶兔 提交于 2019-12-21 02:28:33
问题 I use simplified controller and have no service container. I'm trying to inject doctrine into a service. Here is the error: ContextErrorException: Catchable Fatal Error: Argument 1 passed to Acme\Controller\WebController::__construct() must be an instance of Doctrine\ORM\EntityManager, none given, called in /home/hcs/Core/app/cache/dev/appDevDebugProjectContainer.php on line 3036 and defined in /home/hcs/Core/src/Acme/Controller/WebController.php line 28 Here is my service def: doctrine: dbal

Updating (from the inverse side) bidirectional many-to-many relationships in Doctrine 2?

走远了吗. 提交于 2019-12-21 02:27:24
问题 Customer is the inverse side of "keywords/customers" relationship with Keyword : /** * @ORM\ManyToMany(targetEntity="Keyword", mappedBy="customers", * cascade={"persist", "remove"} * ) */ protected $keywords; When creating a new customer, one should select one or more keywords. The entity form field is: $form->add($this->factory->createNamed('entity', 'keywords', null, array( 'class' => 'Acme\HelloBundle\Entity\Keyword', 'property' => 'select_label', 'multiple' => true, 'expanded' => true, ))

Symfony Cache doctrine/orm/Proxies failed to open stream /Proxy/AbstractProxyFactory.php on line 209

醉酒当歌 提交于 2019-12-20 17:36:09
问题 I'm try to move symfony to shared host. I moved symfony structure to / and my web folder is /public_html. Warning: require(/home/user/app/cache/prod/doctrine/orm/Proxies/__CG__UserBundleEntityUser.php): failed to open stream: No such file or directory in /home/user/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php on line 209 Warning: require(/home/user/app/cache/prod/doctrine/orm/Proxies/__CG__UserBundleEntityUser.php): failed to open stream: No such file or directory

Zend 1.11 and Doctrine 2 Auto generate everything needed from already existing database

自闭症网瘾萝莉.ら 提交于 2019-12-20 11:29:10
问题 I am new to ORM and I am really keen to learn it. I successfully managed to install all classes and configurations for Doctrine 2.1 with Zend 1.11.x by following this tutorial. http://www.zendcasts.com/unit-testing-doctrine-2-entities/2011/02/ Which uses Bisna plugin and doctrine scripts. Now my problem is he is clearly explaining how to create entities and tables through doctrine classes but do not explain how to auto generate the proxies and repo classes from already existing database which

Zend 1.11 and Doctrine 2 Auto generate everything needed from already existing database

元气小坏坏 提交于 2019-12-20 11:28:47
问题 I am new to ORM and I am really keen to learn it. I successfully managed to install all classes and configurations for Doctrine 2.1 with Zend 1.11.x by following this tutorial. http://www.zendcasts.com/unit-testing-doctrine-2-entities/2011/02/ Which uses Bisna plugin and doctrine scripts. Now my problem is he is clearly explaining how to create entities and tables through doctrine classes but do not explain how to auto generate the proxies and repo classes from already existing database which

Integrating ZF/Doctrine2: Where do i put my Models/Entities & Proxy classes

僤鯓⒐⒋嵵緔 提交于 2019-12-20 10:21:43
问题 if i do integrate Zend Framework 1.10 with Doctrine 2 where do i put my Doctrine Models/Entities and Proxies? i thought of the /application or the /library directories. if i do put in the /library directory tho, will it interfere with ZF autoloading classes from there since the classes there will be using PHP 5.3 namespaces vs PEAR style namespaces. 回答1: I'm working on an application that integrates Doctrine 2 with ZF1.10 also.You don't need to use the Doctrine auto loader at all. 1) In your