doctrine-orm

Symfony login authentication returning Error: Call to a member function toArray() on a non-object

强颜欢笑 提交于 2020-01-29 23:39:06
问题 I am working on a website that is built using symfony 2.5, the requirement was that each user needs to have a only one role (user cannot have more than 1 role) so in users table where the username and passwords go there is another column by the name role which holds ROLE_ADMIN for admin people and ROLE_STAFF for company staff, so while authenticating if my getRoles function looks like the following i am able to login just fine as an admin public function getRoles() { return array('ROLE_ADMIN'

Symfony login authentication returning Error: Call to a member function toArray() on a non-object

a 夏天 提交于 2020-01-29 23:37:48
问题 I am working on a website that is built using symfony 2.5, the requirement was that each user needs to have a only one role (user cannot have more than 1 role) so in users table where the username and passwords go there is another column by the name role which holds ROLE_ADMIN for admin people and ROLE_STAFF for company staff, so while authenticating if my getRoles function looks like the following i am able to login just fine as an admin public function getRoles() { return array('ROLE_ADMIN'

Symfony login authentication returning Error: Call to a member function toArray() on a non-object

家住魔仙堡 提交于 2020-01-29 23:34:04
问题 I am working on a website that is built using symfony 2.5, the requirement was that each user needs to have a only one role (user cannot have more than 1 role) so in users table where the username and passwords go there is another column by the name role which holds ROLE_ADMIN for admin people and ROLE_STAFF for company staff, so while authenticating if my getRoles function looks like the following i am able to login just fine as an admin public function getRoles() { return array('ROLE_ADMIN'

ZF2 + doctrine without composer

為{幸葍}努か 提交于 2020-01-28 11:11:57
问题 I have a working ZF2 (skeleton) application and want to integrate Doctrine. I have downloaded the 2 modules (DoctrineModule and DoctrineORMModule) from github as I'm unable to use composer (so please don't answer with; "get composer"). After hours of trying to find the problem I keep getting the following error: Fatal error: Class 'Doctrine\Common\Annotations\AnnotationRegistry' not found in doctrine/DoctrineModule/src/DoctrineModule/Module.php on line 54. I have spend hours of searching and

Symfony2 Doctrine entity: How to create table in controller?

狂风中的少年 提交于 2020-01-26 03:17:05
问题 I need some functionality for dynamic creation table in DB. Algorithm is: 1) register new user -> make record in DB (this is simple) 2) after registration create table like user_data_abcdef123456... where abcdef123456 - is random pregenerated hash. this table must created from (for example) existing default entity (user_data_) Entity: Path\To\Entity\UserData: type: entity table: user_data_ .... in Controller do like this: $doctrine = $this->getDoctrine(); /** @var AbstractSchemaManager

Symfony2/Doctrine2 excessive memory usage while running query

ぃ、小莉子 提交于 2020-01-25 23:11:08
问题 This is a separate issue that has developed from [this question thread][1] while loading a simple page displaying a table of data (only 2 object entries) I'm getting a memory emergency error. Can anyone please tell me why? here's the controller: public function indexAction() { $em = $this->getDoctrine() ->getManager(); $titles = $em->getRepository('dvdLoggerdvdBundle:Titles')->getAllTitles(); return $this->render('dvdLoggerdvdBundle:Page:index.html.twig', array( 'titles' => $titles )); } then

Splitting a ManyToMany association into 2 pairs of OneToMany/ManyToOne (Doctrine)

耗尽温柔 提交于 2020-01-25 12:27:25
问题 I'll expose the case with the example (it'll be clearer): I have 'Groupies' (since group is a reserved name) and I have Companies. A Groupie may choose several Companies, and the same aplies in reverse (typical ManyToMany asociation). The thing is: I need to persist some additional data wich are specific of the association itself (let's call it 'Choice'). So, the ManyToMany is replaced by two pairs of OneToMany/ManyToOne asociations, and now each 'choice' has only one 'groupie' and one

@MappedSuperclass vs plain abstract class

て烟熏妆下的殇ゞ 提交于 2020-01-25 11:56:06
问题 I have created a base class for several entities that share the same properties, and I thought that it was a good use case for a @MappedSuperclass : use Doctrine\ORM\Mapping as ORM; /** * @ORM\MappedSuperclass */ abstract class Invoiceable { /** * @ORM\ManyToOne(targetEntity="Invoice") * @ORM\JoinColumn(name="invoiceId", referencedColumnName="id") * * @var Invoice|null */ protected $invoice = null; /** * @ORM\ManyToOne(targetEntity="CreditNote") * @ORM\JoinColumn(name="creditNoteId",

How to save one Doctrine entity to two database tables (required for MySQL optimisation)

流过昼夜 提交于 2020-01-25 11:43:09
问题 In my database I've a table file and a table file_content . The file table stores the metadata of the file such as name , mime and some more. The file_content stores a blob with the file content. I'm not storing the blob in the same table as the metadata for performance reasons only. For a 'version 2' of my project I'm looking into Doctrine (2.3). To me, a "File" seems to be one entity, with properties such as name , mime , extension , content that should be used like this: $file = new File()

How to save one Doctrine entity to two database tables (required for MySQL optimisation)

心不动则不痛 提交于 2020-01-25 11:42:30
问题 In my database I've a table file and a table file_content . The file table stores the metadata of the file such as name , mime and some more. The file_content stores a blob with the file content. I'm not storing the blob in the same table as the metadata for performance reasons only. For a 'version 2' of my project I'm looking into Doctrine (2.3). To me, a "File" seems to be one entity, with properties such as name , mime , extension , content that should be used like this: $file = new File()