doctrine-orm

Optimistic locking fails because Doctrine cannot determine version

陌路散爱 提交于 2020-01-05 09:35:27
问题 I use Doctrine 2 and want to use optimistic locking. It fails with an OptimisticLockException and the error message is The optimistic lock failed, version 1 was expected, but is actually . Please not, that the error message stops after the "actually". It seems Doctrine is not able to determine the version of the entity. My simplified entity code is: <?php declare(encoding='UTF-8'); use Doctrine\ORM\Mapping as ORM; /** * @ORM\Entity * @ORM\Table( name = "person" ) */ class Person extends

Symfony2 Form Events Listener and Data Transformer Error Cannot instantiate interface Doctrine\…\ObjectManager

混江龙づ霸主 提交于 2020-01-05 09:27:55
问题 I'm working on a Symfony 2.3 form which require that a field be only available on "create new" mode. The field is a link in a Many-to-One relationship, i've managed to change the dropdown list by using a jQuery AutoComplete for ease of use via a FormEvents::PRE_SET_DATA event ,however the FormEvents::PRE_SUBMIT which is to turn the ID supplied into an object require a Doctrine ObjectManager. This turn to be an Interface and throw the 'Cannot instantiate interface Doctrine\Common\Persistence

Symfony Doctrine joining a one to many relationship

烂漫一生 提交于 2020-01-05 09:08:54
问题 I want to join two tables together to get retrieve all the entities in one search. I have a one to many relationship: Jedi and Member. One member group can have many Jedi's. I want to make a form to search by one entity and displays all of the information as a whole. Example: Search for a Jedi by its assigned color -> retrieving name, age, gender, color, and rank. Jedi.php: class Jedi { /** * @var integer * * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy=

Netbeans Auto-Complete Not Working For Custom PHP Class

送分小仙女□ 提交于 2020-01-05 08:46:14
问题 I've got the following class in a Zend Framework project: <?php /** * User's class * * This class should be responsible for all * * @author Steve Davies * @copyright 2012 * @version SVN: $Id$ */ class Api_Admin_Users extends Api_Core { /** * Class Constructor * * @return void */ public function __construct() { parent::__construct(); } /** * Get User's name * * This returns the user's name * * @return void */ public function new() { $user = self::_instance()->_em->getRepository('UserManagement

Delete row from related entity in many to many relationship in Doctrine2

一曲冷凌霜 提交于 2020-01-05 07:41:22
问题 I have this entity: class FabricanteProductoSolicitud { use IdentifierAutogeneratedEntityTrait; /** * @ORM\ManyToOne(targetEntity="\AppBundle\Entity\FabricanteDistribuidor") * @ORM\JoinColumn(name="fabricante_distribuidor_id", referencedColumnName="id") */ protected $fabricante_distribuidor; /** * @ORM\ManyToOne(targetEntity="\AppBundle\Entity\ProductoSolicitud") * @ORM\JoinColumn(name="producto_solicitud_id", referencedColumnName="id") */ protected $producto_solicitud; /** * @ORM\ManyToMany

Installing Doctrine2 with PEAR

六眼飞鱼酱① 提交于 2020-01-05 07:33:03
问题 While I tried this: sudo pear install -o pear.doctrine-project.org/DoctrineORM I got the following error: Package "pear.doctrine-project.org/DoctrineORM" dependency "pear.symfony.com/Console" has no releases Package "pear.doctrine-project.org/DoctrineDBAL" dependency "pear.symfony.com/Console" has no releases doctrine/DoctrineORM requires package "pear.symfony.com/Console" (version >= 2.0.0) doctrine/DoctrineORM requires package "pear.symfony.com/Yaml" (version >= 2.0.0), installed version is

How to write this query in query builder?

你。 提交于 2020-01-05 05:56:28
问题 I have the following (exemplary) query: SELECT * FROM User u LEFT JOIN section_user su ON (su.user_id = u.id AND su.section_id = 3) WHERE section_id is null I am trying to rebuild it in Symfony2 on a many-to-many relationship between users and sections with query builder but I am failing. I thought it would look like this, which proves to be wrong: $er->createQueryBuilder('u') ->leftJoin('u.sections', 's', 'WITH', 's = :section') ->where('s is null') ->setParameter('section', $section); Help

Symfony2 file upload fails when second file field is added

為{幸葍}努か 提交于 2020-01-05 04:18:09
问题 I'm trying to upload 2 images with 2 form fields. My form: ->add('zdjecie', FileType::class, array('label' => 'Zdjecie (img file)')) ->add('zdjecieMIN', FileType::class, array('label' => 'Zdjecie miniatura (img file)')) Entity: /** * @ORM\Column(type="string") * * @Assert\NotBlank(message="Dodaj zdjecie miniaturke") * @Assert\File(mimeTypes={"image/png", "image/jpeg", "image/jpg",}) */ private $zdjecieMIN; public function getZdjecieMIN() { return $this->zdjecieMIN; } public function

Recover values select imput related entities doctrine symfony 2

一笑奈何 提交于 2020-01-05 04:03:16
问题 I'm trying to create a form based on my related entities in doctrine by Symfony 2. I have different entities: Tematica, Personal, Hilo, Consultante, Consulta, Consulta_Asignatura and Asignatura. I reach to persist all my data, nevertheless have some problems with entities Hilo Personal and Tematica. In my form need to show select imput, it should have all "Enunciado" rows and later recover Email of selected option in this select input. I'll share my code, I hope somebody can help my. class

Symfony2 doctrine connect to database via SSL

北慕城南 提交于 2020-01-05 03:37:26
问题 Trying to connect to my MySQL database via SSL, I have successfully established the connection from my webserver via ssh with the following command line: mysql -h my.host.here --port=5454 -v --ssl-ca=/etc/apache2/ssl/mysql/ca-cert.pem --ssl-cert=/etc/apache2/ssl/mysql/client-cert.pem --ssl-key=/etc/apache2/ssl/mysql/client-key.pem -u user -p However, trying to set up the same connection in symfony2 and doctrine, all I keep getting is an "SSL error" $params = array( 'driver' => 'pdo_mysql',