doctrine

How to Extend a Fieldset in ZF2

非 Y 不嫁゛ 提交于 2019-12-11 19:26:23
问题 Doctrine’s Class Table Inheritance mapping strategy involves joining a parent table with one of a number of child tables depending on the value in a discriminator column in the parent table. For example, a parent table might contain the columns a, b, and c; with the values in column c being either foo or bar . A child table named ‘foo’ might contain the columns d, e, f and g; while a child table named ‘bar’ might contain the columns p, q, r and s. A single entity is defined for the parent and

Lazy load between referenced documents on MongoDB with Doctrine ODM

与世无争的帅哥 提交于 2019-12-11 19:19:19
问题 Helo, firstly, please excuse my English, is not very good. I am migrating the data container of a Symfony2 application to MongoDB, before that it run with MySQL. I added the DoctrineMongoDBBundle and "almost everything" works perfectly. I have some references between documents in which I would like to keep the "lazy load" pattern offered by the Doctrine ORM. I have read the official documentation for Doctrine ODM, http://docs.doctrine-project.org/projects/doctrine-mongodb-odm/en/latest

Symfony2 - Doctrine ArrayCollection methods coming back as undefined

*爱你&永不变心* 提交于 2019-12-11 18:59:33
问题 This is odd. I have an entity that can contain an ArrayCollection of other, related entities. When I make a couple of helper methods to allow me to add/retrieve the value of a singular entity, I get a Symfony2 exception telling me the method is not defined. I'm including the namespace, so I'm at a loss as to what the problem is. Code (names changed slightly due to a NDA) below: namespace Acme\MyBundle\Entity; use Doctrine\ORM\Mapping as ORM; use Doctrine\Common\Collections\ArrayCollection; //

Halite/Doctrine vs MySQL AES_ENCRYPT: security/performance

。_饼干妹妹 提交于 2019-12-11 18:51:04
问题 I have a web application (Symfony 4) that needs to be HIPAA compliant which (among other things) means I need to encrypt data. Originally I was just going to encrypt data in PHP via Halite and save it in the database, however there are some fields (last name, first name, phone number) I can't encrypt because they will be used for a search field and therefore I need (?) MySQL to be able to use where clauses. For this reason I was going to use AES_ENCRYPT and set the MySQL connection to go over

Symfony 1.4 doctrine model object data retrieve issue

梦想的初衷 提交于 2019-12-11 18:41:37
问题 In my symfony 1.4 application i'm using doctrine data models.I'm new to symfony and doctrine.I generated doctrine models from command-line after defining database table information in the schema.yml file.Those generated successfully.Then i created a custom function inside Table.class.php file.Following is that. class Table extends BaseTable { public function getuname() { $user=new Table(); $uname=$user->getUsername(); return $uname; } } I want to know how to call this inside the controller ?

pagerfanta - DoctrineORMAdapter Sorting

徘徊边缘 提交于 2019-12-11 18:25:21
问题 Although I know this is trivial I'm stuck trying to implement the pagerfanta Paginator using the DoctrineORMAdapter, I want to paginate all entities sorted by id in descending order, the final SQL I want is this: SELECT id, name FROM User ORDER BY id DESC LIMIT 0, 5; Suppose I had users from A to Z and I want to limit them by 5 each page, what DoctrineORMAdapter is paginating results in User E to A listed in the first page, while what I actually expect is to see User Z to user V in the first

Symfony2 - how to print joined tables output

老子叫甜甜 提交于 2019-12-11 18:06:45
问题 I have two joined tables. With print_r I am getting something like this Array ( [0] => GameShelf\UsersBundle\Entity\Ownership Object ( [id:GameShelf\UsersBundle\Entity\Ownership:private] => 1 [type:GameShelf\UsersBundle\Entity\Ownership:private] => 1 [time:GameShelf\UsersBundle\Entity\Ownership:private] => 2010-02-05 11:00:00 [game:GameShelf\UsersBundle\Entity\Ownership:private] => Doctrine\ORM\PersistentCollection Object ( [snapshot:Doctrine\ORM\PersistentCollection:private] => Array ( [0] =

Insert into junction table with relationship many to many in symfony 4

房东的猫 提交于 2019-12-11 17:24:04
问题 I have a next tables: quiz , question and junction table question_quiz . I have a many-to-many relationship. Insert is working for the tables quiz and questions but I don't understand how insert in junction table. Entity quiz. class Quiz { /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=191) */ private $name; /** * @ORM\ManyToMany(targetEntity="App\Entity\Question", mappedBy="quiz", cascade={"persist"}) */ private

Doctrine 2 CLI commands from within PHP

流过昼夜 提交于 2019-12-11 16:54:59
问题 Hey all. I am writing a program that will transform some data in our database, and then call Doctrine to build YAML files from said Mysql Database structure. I have Doctrine working from within PHP. However I can't figure out how to call the CLI commands from within PHP. Following is the Doctrine 2 CLI command that does what I need. php ./doctrine orm:convert-mapping --filter="users" --from-database yml ./test This command works from the Linux command line, but how to I do this same thing via

Is there a way or a plugin to configure SQL Dialects as DQL in PhpStorm?

眉间皱痕 提交于 2019-12-11 16:39:19
问题 In PhpStorm, I can change global, project or directories settings with existing SQL Dialects, but is there a way to configure SQL Dialects as Symfony/DQL in PhpStorm or a way to detect that App:Panel is a valid entity, not a table? ( App:Panel table name is te_panel ) I read this answer which explains that we have to add a Java plugin, because it's currently not possible to add a new SQL Dialect on PhpStorm. As example, this is an error that PhpStorm is throwing: The : between App and Panel