doctrine

Query field of root entity in doctrine (joined) class table inheritance

六眼飞鱼酱① 提交于 2019-12-14 02:29:54
问题 I have a entity named Content. This is my abstract base class for all my other Content related entities. /** * MyBundle\Entity\Content * * @ORM\Entity(repositoryClass="MyBundle\Repository\ContentRepository") * @ORM\InheritanceType("JOINED") * @ORM\DiscriminatorColumn(name="discr", type="string") * @ORM\Table(name="MyBundle_content") * @ORM\HasLifecycleCallbacks */ abstract class Content Content properties: id updated .... Further I have a lot of different entities that all extend Content. In

doctrine 2.0 cascase error

[亡魂溺海] 提交于 2019-12-14 02:28:12
问题 I am getting following error in doctrine... A new entity was found through a relationship that was not configured to cascade persist operations: Default_Model_EventImages@000000004b59e58d000000003ff05ded. Explicitly persist the new entity or configure cascading persist operations on the relationship. Event model <?php /** * @Entity * @Table(name="events") */ class Default_Model_Event { /** * @Id @Column(name="id", type="integer") * @GeneratedValue(strategy="AUTO") */ private $id; /** *

AppBundle symfony 4

試著忘記壹切 提交于 2019-12-13 22:38:57
问题 I have a problem with Symfony 4 , I want generate entities from an existing database with the command : php bin/console doctrine:mapping:import --force AppBundle xml But an error appears : Bundle "AppBundle" does not exist or it is not enabled. Maybe you forgot to add it in the registerBundles() method of your App\Kernel.php file? I try to import in the file kernel.php in registerBundles() : new AppBundle/AppBundle(); but undefined class and when I create it in src/AppBundle/AppBundle.php : <

Relation to many and get without this

て烟熏妆下的殇ゞ 提交于 2019-12-13 22:24:58
问题 User: id | name 1 | one 2 | two 3 | three 4 | four 5 | five House: id | name 1 | London 2 | Barcelona UserHouse: id_user | id_house 1 | 1 2 | 2 4 | 1 $q = Doctrine_Query::create() ->from('User u') // many selectors here ->leftJoin('u.UserHouse uh') ->addWhere('????????'); $users = $q->execute(); I would like get all user without House (that is - not in table UserHouse) - this should return me user 3 and 5. I know, i can use: ->from('UserHouse uh') and next relation to User but i must have and

Update Doctrine Cache Values in Symfony

筅森魡賤 提交于 2019-12-13 19:27:00
问题 I have a Symfony Standard Distribution app and use Doctrine's query builder and result cache to speed up database queries. I also assign unique ids to all my caches such as .... ->getQuery() ->useResultCache(true, 2592000, 'single_product_query_id_'.$id) ->getOneOrNullResult(); .... When a product field changes I can delete this specific cache using .... $em = $this->getDoctrine()->getManager(); $cacheDriver = $em->getConfiguration()->getResultCacheImpl(); $cache = $cacheDriver->fetch('single

Entity Generation for Single Table

拥有回忆 提交于 2019-12-13 19:01:28
问题 So I want to generate entities for specific tables in a database that has a huge amount of tables. Here is the command I'm trying: php app/console doctrine:mapping:convert yml ./src/MyNamespace/Bundle/MyNamespaceBundle/Resources/config/doctrine/metadata/orm --from-database --em=my_manager --filter=TblReports --verbose Here is the error: [Doctrine\DBAL\DBALException] Unknown database type unknown requested, Doctrine\DBAL\Platforms\PostgreSqlPlatform may not support it. Now I can run this

Symfony throwing ServiceCircularReferenceException

荒凉一梦 提交于 2019-12-13 18:34:21
问题 I am using Symfony 2.7 and i am writing all logs to data based on below tutorial https://nehalist.io/logging-events-to-database-in-symfony/ In service i have monolog.db_handler: class: AppBundle\Util\MonologDBHandler arguments: ['@doctrine.orm.entity_manager'] in monlog db handler i have following class MonologDBHandler extends AbstractProcessingHandler { /** * @var EntityManagerInterface */ protected $em; /** * MonologDBHandler constructor. * @param EntityManagerInterface $em */ public

symfony doesn't like PostgreSQL with doctrine:build-schema

冷暖自知 提交于 2019-12-13 17:40:56
问题 I'm having a weird thing happen when I run doctrine:build-schema with my PostgreSQL database. It should just work, of course, but instead I'm getting this: jason@ve:~/salon$ ./symfony doctrine:build-schema >> doctrine generating yaml schema from database SQLSTATE[42P01]: Undefined table: 7 ERROR: missing FROM-clause entry for table "t" LINE 6: ... t.typtype ... ^. Failing Query: " SELECT ordinal_position as attnum, column_name as field, udt_name as type, data_type as complete_type, t.typtype

how to get role from Zend_Auth/Zend_ACL when using a Doctrine adapter? getting all work together

拜拜、爱过 提交于 2019-12-13 17:33:15
问题 I'm using Zend_Auth with a project using doctrine.I believe every bootstrapping is done correctly and i can log in. my adapter looks like this: class Abra_Auth_Adapter_Doctrine implements Zend_Auth_Adapter_Interface { protected $_resultArray; private $username; private $password; public function __construct($username, $password) { $this->username = $username; $this->password = $password; } //based on feedbacks as response authenticate has changed to this public function authenticate() { $q =

How to set the default hydrator in Doctrine?

荒凉一梦 提交于 2019-12-13 12:31:30
问题 I can't find a way to set the default hydrator in Doctrine. It should be available. Right? http://docs.doctrine-project.org/projects/doctrine1/en/latest/en/manual/data-hydrators.html#writing-hydration-method The above documentation page explains how to create a custom hydrator. The drawback here is that you need to "specify" the hydrator each and every time you execute a query. 回答1: I figured this out by reading Chris Gutierrez's comment and changing some stuff. First, define an extension