doctrine

doctrine subquery in select with join

前提是你 提交于 2019-12-25 05:15:17
问题 schema.yml: Membership: columns: id: { type: integer(4), notnull: true, unique: true, primary: true, autoincrement: true } organisation_id: { type: integer(4), notnull: true } membership_subcategory_id: { type: integer(4), notnull: true } start: { type: timestamp } end: { type: timestamp } amount: { type: decimal, size: 2 } amount_paid: { type: decimal, size: 2 } notes: { type: clob (16000000), notnull: false } payment_type: { type: string(20), notnull: true } order_id: { type: integer(4),

Entity doesn't associate correctly

寵の児 提交于 2019-12-25 04:39:12
问题 I have the next relationships: Presupuesto: oneToMany with Revision Revision: oneToMany with Capitulo Capitulo: oneToMany with Requisito Requisito: oneToMany with Articulo I have a form embedded with these entities and 'addTagForm' set. The problem is that when I submit the form, everything is associated correctly except from Revision with Capitulo , which associates as null. Below there's the most relevant information about these two entities: Revision.php /** * @ORM\OneToMany(targetEntity=

SymBlog: Undefined method. The method name must start with either findBy or findOneBy

北城余情 提交于 2019-12-25 04:10:59
问题 I am currently working with Symfony2's Part 4 OF The SymBlog project I am getting this ERROR message: Undefined method 'getLatestPosts'. The method name must start with either findBy or findOneBy!500 Internal Server Error - BadMethodCallException This is my PostRepository Class: <?php namespace BLog\BlogBundle\Entity; use Doctrine\ORM\EntityRepository; class PostRepository extends EntityRepository { public function getLatestPosts($limit = null) { $qp = $this->createQueryBuilder('p') ->select(

SymBlog: Undefined method. The method name must start with either findBy or findOneBy

戏子无情 提交于 2019-12-25 04:10:12
问题 I am currently working with Symfony2's Part 4 OF The SymBlog project I am getting this ERROR message: Undefined method 'getLatestPosts'. The method name must start with either findBy or findOneBy!500 Internal Server Error - BadMethodCallException This is my PostRepository Class: <?php namespace BLog\BlogBundle\Entity; use Doctrine\ORM\EntityRepository; class PostRepository extends EntityRepository { public function getLatestPosts($limit = null) { $qp = $this->createQueryBuilder('p') ->select(

Translation Behaviour is looking for \Enti folder

梦想与她 提交于 2019-12-25 03:06:22
问题 I am trying to translate the slug of a BlogPost in multiple languages. I decided to use KnpLabs/DoctrineBehaviors to help me with the task. I installed the bundle, got the sluggable behaviour to work in minutes. However, when I add the translatable behaviour, I get can't update my schema. I get the following error when I try to update my database schema (I know that the --force is not on the picture, but it does the same result). Here's my BlogPost Entity : namespace MyProject\MyBundle\Entity

Symfony2 Inserting Error “Warning: spl_object_hash() expects parameter…”

萝らか妹 提交于 2019-12-25 02:58:18
问题 when I try to persist my object and flush it I get this error message: Warning: spl_object_hash() expects parameter 1 to be object, integer given 500 Internal Server Error - ContextErrorException I know this kind of question has been posted a lot in stack overflow but it still couldn't solve my problem. That's why I ask again here, hopefully some one can help me. Below are my code for to persist the user class: $package = $em->getRepository('MyBundle:Package')->findOneBy(array('id' => 1));

Twig error - varibale does not exist for Sonata Admin

一笑奈何 提交于 2019-12-25 02:53:53
问题 I am passing query results to my twig view but it can't find that varibale. It' Sonata Admin details view with multiple tabs. Tamplate is renderig and when I pass a string it renders but when I try to call query builder with "getTransactions" it throws: Variable "card" does not exist. Code: $card = $this->getCardTransactions(); $showMapper->tab('Card transactions') ->add('Data', 'date', array( 'template' => "@AdminTemplates/details.html.twig", 'card' => $card )) ->end() ->end() And simple as

get all groups from the Users - sfDoctrineGuardPlugin

喜欢而已 提交于 2019-12-25 02:15:49
问题 In sfDoctrineGuardPlugin is: sfGuardUser: actAs: [Timestampable] columns: first_name: string(255) last_name: string(255) // indexes: is_active_idx: fields: [is_active] relations: Groups: class: sfGuardGroup local: user_id foreign: group_id refClass: sfGuardUserGroup foreignAlias: Users sfGuardGroup: actAs: [Timestampable] columns: name: type: string(255) unique: true description: string(1000) relations: Users: class: sfGuardUser refClass: sfGuardUserGroup local: group_id foreign: user_id

Table creaction on doctrine migration for custom behavior

不羁岁月 提交于 2019-12-25 02:15:34
问题 I've created custom doctrine(1.2) behavior which should create tables for models (very simmilar to i18n behavior). I see this tables in schema.sql, and if i execute it everything is fine, but this is no such tables if my migrations diff (doctrine:generate-migrations-diff). What i'm doing wrong? class DescriptionableGenerator extends Doctrine_Record_Generator { protected $_options = array( 'className' => '%CLASS%Description', 'tableName' => '%TABLE%_description', 'fields' => array(),

SonataUserBundle + FOSUserBundle Annotation Issue Doctrine Primary Key Error

扶醉桌前 提交于 2019-12-25 01:45:41
问题 Using Symfony 4.1, Sonata User Bundle 4.x, and FOSUserBundle 2.1.2. I am trying to override the table names for the User and Group tables. I therefore added annotations to the auto generated user and group classes: use Sonata\UserBundle\Entity\BaseGroup as BaseGroup; use Doctrine\ORM\Mapping as ORM; /** * This file has been generated by the SonataEasyExtendsBundle. * @ORM\Entity() * @ORM\Table(name="aegis_group") * @link https://sonata-project.org/easy-extends * References: * @link http://www