doctrine

The Doctrine repository “Doctrine\ORM\EntityRepository” must implement UserProviderInterface in symfony2

只愿长相守 提交于 2020-01-03 06:30:53
问题 I am getting above error when login. With property option in security.yml it is working. I have added the @ORM\Entity(repositoryClass="versionR\userBundle\Entity\UserRepository") line on my entity class, dobule checked path, cleared cache but no luck. User entity class <?php namespace versionR\userBundle\Entity; use Doctrine\ORM\Mapping as ORM; //use Symfony\Component\Security\Core\Role\Role; use Symfony\Component\Security\Core\User\UserInterface; /** * User * * @ORM\Table(name="user") * @ORM

Silex and Doctrine - ORMException: Unknown Entity namespace alias [semi fixed]

大兔子大兔子 提交于 2020-01-03 06:07:21
问题 I'm trying to use the Doctrine components in my app built using silex. I was able to get it to work - well almost. I have my "User" entity and the corresponding repository When doing $app['em']->getRepository('Foo\Entity\User')->findAll() works as expected, however when trying to make a custom query $this->getEntityManager() ->createQuery( 'SELECT u FROM Foo:User u WHERE c.id = :x' ) ->setParameter('x',$in) ->getResult(); I get this exception ORMException: Unknown Entity namespace alias 'Foo'

Silex and Doctrine - ORMException: Unknown Entity namespace alias [semi fixed]

雨燕双飞 提交于 2020-01-03 06:06:48
问题 I'm trying to use the Doctrine components in my app built using silex. I was able to get it to work - well almost. I have my "User" entity and the corresponding repository When doing $app['em']->getRepository('Foo\Entity\User')->findAll() works as expected, however when trying to make a custom query $this->getEntityManager() ->createQuery( 'SELECT u FROM Foo:User u WHERE c.id = :x' ) ->setParameter('x',$in) ->getResult(); I get this exception ORMException: Unknown Entity namespace alias 'Foo'

Get Doctrine or pass in service without using __construct - Symfony2

痞子三分冷 提交于 2020-01-03 04:52:22
问题 I'm trying to extend a class, but I have this problem: (1) I need to conduct a simple database query, but if I pass in @doctrine.orm.entity_manager in services.yml I then need to pass a load of other values in and call parent::__construct (for the parent class) and I just can't get it working (another question exists for that but no luck). (2) If I don't create a __construct in my new extended class then it works but I can't get access to conduct the DB query. Is there a way of getting access

Strange problem when using HAVING() and Doctrine_Pager

橙三吉。 提交于 2020-01-03 03:04:07
问题 My program generates this DQL using echo $q->getDql(); reformated for easier reading: SELECT o.*, t.*, COUNT(t.id) AS num_of_reservations FROM Property o LEFT JOIN o.Reservation t WITH t.status=? AND ( (t.start_date<=? AND t.end_date>=?) OR (t.start_date>=? AND t.start_date <= ?) ) GROUP BY o.id HAVING num_of_reservations < o.nr_of_bookings Using PHP unit tests, I get results as expected. However, when I send this Doctrine_Query to Doctrine_Pager, I get this error: Fatal error: Uncaught

How do you override your team's default databases.yml in Doctrine for using your local settings?

强颜欢笑 提交于 2020-01-02 11:00:14
问题 Looking for a way to cleanly override the values of databases.yml in Doctrine / Symfony in order to use my own local settings? The idea is not touching databases.yml and using some sort of local unversioned file to override that default. I'm trying to find out how without much success yet :/ 回答1: For this kind of configuration file, that contains stuff that depends on the environment (dev, testing, staging, production, ...) , I generally use one file per environment, and all are commited to

Conditional IF statement in a PHP Doctrine 1.2 SET statement

倖福魔咒の 提交于 2020-01-02 08:02:47
问题 I would like find the correct syntax for the SET line: Doctrine_Query::create() ->update('Media m') ->set('m.fallback IF(m.id = ?, 1, 0)', $id) <-- not correct ->execute(); Thanks for any help! 回答1: I think that could be done with two queries: Doctrine_Query::create() ->update('Media m') ->set('m.fallback', 1) ->where('m.id = ?', $id) ->execute(); Doctrine_Query::create() ->update('Media m') ->set('m.fallback', 0) ->where('m.id != ?', $id) ->execute(); I don't know if it suits you, but at

Conditional IF statement in a PHP Doctrine 1.2 SET statement

邮差的信 提交于 2020-01-02 08:02:10
问题 I would like find the correct syntax for the SET line: Doctrine_Query::create() ->update('Media m') ->set('m.fallback IF(m.id = ?, 1, 0)', $id) <-- not correct ->execute(); Thanks for any help! 回答1: I think that could be done with two queries: Doctrine_Query::create() ->update('Media m') ->set('m.fallback', 1) ->where('m.id = ?', $id) ->execute(); Doctrine_Query::create() ->update('Media m') ->set('m.fallback', 0) ->where('m.id != ?', $id) ->execute(); I don't know if it suits you, but at

multiple connections with doctrine in symfony 2.3

本秂侑毒 提交于 2020-01-02 07:37:11
问题 So I'm trying to do a multiple connection with doctrine in my symfony project. First, I was only using one database, then I needed to add another. this was before : # Doctrine Configuration doctrine: dbal: default_connection: extranet connections: extranet: driver: pdo_mysql host: "%db_extranet_host%" port: "%db_extranet_port%" dbname: "%db_extranet_name%" user: "%db_extranet_user%" password: "%db_extranet_password%" charset: UTF8 orm: auto_generate_proxy_classes: "%kernel.debug%" entity

How to disable FOREIGN KEY CONSTRAINT when using Doctrine generate migration?

好久不见. 提交于 2020-01-02 07:06:28
问题 I often change/add some field in Entity and using bin/console make:migration to generate migrations, that's convenience just like in Rails or Django. But I do not need Foreign Key Constraint when I am using Doctrine Relationships( ManyToOne , OneToMany ...). I have to delete lines contained Foreign Key Constraint in generated migrations. But When I doing some changes with Entity, and run bin/console make:migration , It will add Foreign Key Constraint again, it is annoying. I do not care about