[DDC-3543] How to map and use a DB View from Doctrine2 Created: 26/Jan/15  Updated: 26/Jan/15  Resolved: 26/Jan/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Mapping Drivers, ORM
Affects Version/s: 2.4.7
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Reynier Perez Mira Assignee: Marco Pivetta
Resolution: Invalid Votes: 0
Labels: None


 Description   

I have a view on nomencladores schema called obtenerPaisesPorFabricanteProductoSolicitud. This is the content for the view:

    SELECT
    	ps.id AS psid,
    	ps.nombre,
    	fps.id AS fpsid
    FROM
    	(
    		(
    			nomencladores.pais ps
    			JOIN nomencladores.pais_fabricante_producto_solicitud pfps ON ((pfps.pais_id = ps.id))
    		)
    		JOIN negocio.fabricante_producto_solicitud fps ON (
    			(
    				pfps.fabricante_producto_solicitud_id = fps.id
    			)
    		)
    	);

I'm trying to map the view as follow:

    use Doctrine\ORM\Mapping as ORM;
    
    /**
     * @ORM\Entity
     * @ORM\Table(name="nomencladores.obtenerPaisesPorFabricanteProductoSolicitud", schema="nomencladores")
     */
    class ObtenerPaisesPorFabricanteProductoSolicitud
    {
        /**
         * @ORM\Id
         * @ORM\Column(name="psid", type="integer", nullable=false, unique=true)
         */
        protected $ps;
    
        /**
         * @ORM\Column(name="fpsid", type="integer")
         */
        protected $fps;
    
        /**
         * @ORM\Column(name="nombre", type="string")
         */
        protected $nombre;
    
        public function getPs()
        {
            return $this->ps;
        }
    
        public function getFps()
        {
            return $this->fps;
        }
    
        public function getNombre()
        {
            return $this->nombre;
        }
    }

But any time I run this code on it:

    $ent = $em->getRepository("AppBundle:ObtenerPaisesPorFabricanteProductoSolicitud")->findBy(
        array(
            "fps" => $entF->getId()
        )
    );

I got this result:

An exception occurred while executing 'SELECT t0.psid AS psid1,
t0.fpsid AS fpsid2, t0.nombre AS nombre3 FROM
nomencladores.obtenerPaisesPorFabricanteProductoSolicitud t0 WHERE
t0.fpsid = ?' with params [22]:
SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "nomencladores.obtenerpaisesporfabricanteproductosolicitud" does not
exist LINE 1: ...d1, t0.fpsid AS fpsid2, t0.nombre AS nombre3 FROM
nomenclado...

If I remove the annotations then the error transform on this:

Class "AppBundle\Entity\ObtenerPaisesPorFabricanteProductoSolicitud" is not a valid entity or mapped super class."

Why Doctrine2 or Symfony tries to execute the query instead go through the view? How I can execute the view from Symfony2/Doctrine2 side?



 Comments   
Comment by Marco Pivetta [ 26/Jan/15 ]

Nothing wrong here: the SQL generated by the ORM is correct, but your view definition is wrong: try running the select in console, manually.





[DDC-3542] [GH-1287] Typo fix Created: 25/Jan/15  Updated: 26/Jan/15  Resolved: 26/Jan/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Documentation
Affects Version/s: None
Fix Version/s: 2.5
Security Level: All

Type: Documentation Priority: Trivial
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: typo


 Description   

This issue is created automatically through a Github pull request on behalf of BenMorel:

Url: https://github.com/doctrine/doctrine2/pull/1287

Message:



 Comments   
Comment by Doctrine Bot [ 26/Jan/15 ]

A related Github Pull-Request [GH-1287] was assigned:
https://github.com/doctrine/doctrine2/pull/1287

Comment by Doctrine Bot [ 26/Jan/15 ]

A related Github Pull-Request [GH-1287] was merged:
https://github.com/doctrine/doctrine2/pull/1287





[DDC-3541] [GH-1286] Removing XDebug from non-coverage builds Created: 25/Jan/15  Updated: 25/Jan/15  Resolved: 25/Jan/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Tools
Affects Version/s: Git Master
Fix Version/s: 2.5
Security Level: All

Type: Improvement Priority: Minor
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: build-speed, ci, travis, xdebug


 Description   

This issue is created automatically through a Github pull request on behalf of Ocramius:

Url: https://github.com/doctrine/doctrine2/pull/1286

Message:



 Comments   
Comment by Doctrine Bot [ 25/Jan/15 ]

A related Github Pull-Request [GH-1286] was assigned:
https://github.com/doctrine/doctrine2/pull/1286

Comment by Doctrine Bot [ 25/Jan/15 ]

A related Github Pull-Request [GH-1286] was labeled:
https://github.com/doctrine/doctrine2/pull/1286

Comment by Doctrine Bot [ 25/Jan/15 ]

A related Github Pull-Request [GH-1286] was labeled:
https://github.com/doctrine/doctrine2/pull/1286

Comment by Doctrine Bot [ 25/Jan/15 ]

A related Github Pull-Request [GH-1286] was merged:
https://github.com/doctrine/doctrine2/pull/1286





[DDC-3540] [GH-1285] travis: remove unnecessary database creation Created: 25/Jan/15  Updated: 25/Jan/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: Tools
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Improvement Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Unresolved Votes: 0
Labels: ci, performance, setup, travis

Issue Links:
Reference
relates to DDC-3532 [GH-1278] travis: remove unnecessary ... Resolved

 Description   

This issue is created automatically through a Github pull request on behalf of TomasVotruba:

Url: https://github.com/doctrine/doctrine2/pull/1285

Message:

Ref: #1278



 Comments   
Comment by Doctrine Bot [ 25/Jan/15 ]

A related Github Pull-Request [GH-1285] was assigned:
https://github.com/doctrine/doctrine2/pull/1285

Comment by Doctrine Bot [ 25/Jan/15 ]

A related Github Pull-Request [GH-1285] was labeled:
https://github.com/doctrine/doctrine2/pull/1285





[DDC-3539] [GH-1284] #1189 DDC-3406 derived identity in proxy must be a proxy Created: 24/Jan/15  Updated: 25/Jan/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Dependency
is required for DDC-3406 Proxy returns string instead of object Open

 Description   

This issue is created automatically through a Github pull request on behalf of Ocramius:

Url: https://github.com/doctrine/doctrine2/pull/1284

Message:

This is a horrible hack for #1189.

Not happy with it, this seems like it fixes just the symptom.



 Comments   
Comment by Doctrine Bot [ 24/Jan/15 ]

A related Github Pull-Request [GH-1284] was assigned:
https://github.com/doctrine/doctrine2/pull/1284

Comment by Doctrine Bot [ 24/Jan/15 ]

A related Github Pull-Request [GH-1284] was labeled:
https://github.com/doctrine/doctrine2/pull/1284

Comment by Doctrine Bot [ 24/Jan/15 ]

A related Github Pull-Request [GH-1189] was labeled:
https://github.com/doctrine/doctrine2/pull/1189

Comment by Doctrine Bot [ 25/Jan/15 ]

A related Github Pull-Request [GH-1284] was unlabeled:
https://github.com/doctrine/doctrine2/pull/1284

Comment by Doctrine Bot [ 25/Jan/15 ]

A related Github Pull-Request [GH-1284] was labeled:
https://github.com/doctrine/doctrine2/pull/1284





[DDC-3538] [GH-1283] #1267 - order by broken in pagination logic (reverts #1220) Created: 24/Jan/15  Updated: 24/Jan/15  Resolved: 24/Jan/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Tools
Affects Version/s: Git Master
Fix Version/s: 2.5
Security Level: All

Type: Bug Priority: Critical
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: limitsubqueryoutputwalker, orderBy, orderby, paginator, subquery

Issue Links:
Duplicate
is duplicated by DDC-3519 [GH-1267] Failing test for an ORDER B... Resolved

 Description   

This issue is created automatically through a Github pull request on behalf of Ocramius:

Url: https://github.com/doctrine/doctrine2/pull/1283

Message:

This PR reverts #1220 and merges #1264



 Comments   
Comment by Doctrine Bot [ 24/Jan/15 ]

A related Github Pull-Request [GH-1283] was labeled:
https://github.com/doctrine/doctrine2/pull/1283

Comment by Doctrine Bot [ 24/Jan/15 ]

A related Github Pull-Request [GH-1283] was merged:
https://github.com/doctrine/doctrine2/pull/1283





[DDC-3537] [GH-1282] Hotfix/#1169 extra lazy one to many should not delete referenced entities (backport to 2.4) Created: 24/Jan/15  Updated: 25/Jan/15  Resolved: 25/Jan/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Lazy Loading, ORM
Affects Version/s: 2.4.7
Fix Version/s: 2.4.8
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: delete, extra-lazy, onetomany, update

Issue Links:
Dependency
is required for DDC-3343 `PersistentCollection::removeElement`... Resolved

 Description   

This issue is created automatically through a Github pull request on behalf of Ocramius:

Url: https://github.com/doctrine/doctrine2/pull/1282

Message:

See #1169

This PR backports #1281



 Comments   
Comment by Doctrine Bot [ 24/Jan/15 ]

A related Github Pull-Request [GH-1282] was labeled:
https://github.com/doctrine/doctrine2/pull/1282

Comment by Doctrine Bot [ 24/Jan/15 ]

A related Github Pull-Request [GH-1282] was assigned:
https://github.com/doctrine/doctrine2/pull/1282

Comment by Doctrine Bot [ 25/Jan/15 ]

A related Github Pull-Request [GH-1282] was merged:
https://github.com/doctrine/doctrine2/pull/1282





[DDC-3536] [GH-1281] Hotfix/#1169 extra lazy one to many should not delete referenced entities Created: 24/Jan/15  Updated: 25/Jan/15  Resolved: 25/Jan/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Lazy Loading, ORM
Affects Version/s: Git Master, 2.3.5, 2.4.7
Fix Version/s: 2.5
Security Level: All

Type: Bug Priority: Blocker
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: delete, extra-lazy, onetomany, update

Issue Links:
Dependency
is required for DDC-3343 `PersistentCollection::removeElement`... Resolved

 Description   

This issue is created automatically through a Github pull request on behalf of Ocramius:

Url: https://github.com/doctrine/doctrine2/pull/1281

Message:

This is an alternate fix for #1169 (DDC-3343 http://www.doctrine-project.org/jira/browse/DDC-3343)



 Comments   
Comment by Doctrine Bot [ 24/Jan/15 ]

A related Github Pull-Request [GH-1169] was closed:
https://github.com/doctrine/doctrine2/pull/1169

Comment by Doctrine Bot [ 25/Jan/15 ]

A related Github Pull-Request [GH-1281] was merged:
https://github.com/doctrine/doctrine2/pull/1281





[DDC-3535] Allow binding `Parameter` value object to statements, removing the need for explicit value and type passing Created: 24/Jan/15  Updated: 24/Jan/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: Lazy Loading, ORM
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Task Priority: Critical
Reporter: Marco Pivetta Assignee: Marco Pivetta
Resolution: Unresolved Votes: 0
Labels: binding, criteria, parameters, persister, repository, type


 Comments   
Comment by Marco Pivetta [ 24/Jan/15 ]

We currently have a lot of locations in the code where we use list($values, $types) = $this->computeParameters(); (pseudo-code).

This leads to a lot of code duplication and complexity.

Maybe a Parameter VO may be used instead, or a ParameterCollection with a fixed $types and a mutable $values, and with minimal internal validation.





[DDC-3534] [GH-1280] [DDC-3346] #1277 find one with eager loads is failing Created: 23/Jan/15  Updated: 25/Jan/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: Lazy Loading, ORM
Affects Version/s: Git Master
Fix Version/s: 2.5
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Unresolved Votes: 0
Labels: collection, eager, fetch, hydrator, lazy-loading, many-to-many, onetomany, persister

Issue Links:
Dependency
is required for DDC-3346 findOneBy returns an object with part... Resolved
is required for DDC-3531 [GH-1277] [DDC-3346] Failing test for... Resolved

 Description   

This issue is created automatically through a Github pull request on behalf of Ocramius:

Url: https://github.com/doctrine/doctrine2/pull/1280

Message:

Ping @scaytrase

Note that this is a first revision and needs refactoring, so please consider helping out with that if you can.

Ping @guilhermeblanco: please check the `CachedPersisterContext` stuff: it's dirty as heck, but that's because the persister internal generated SQL caching is inconsistent as heck too.

Resolution path for 2.4.x will be to throw an exception if there is an offset or a limit.



 Comments   
Comment by Doctrine Bot [ 23/Jan/15 ]

A related Github Pull-Request [GH-1277] was assigned:
https://github.com/doctrine/doctrine2/pull/1277

Comment by Doctrine Bot [ 23/Jan/15 ]

A related Github Pull-Request [GH-1277] was closed:
https://github.com/doctrine/doctrine2/pull/1277

Comment by Doctrine Bot [ 24/Jan/15 ]

A related Github Pull-Request [GH-1280] was labeled:
https://github.com/doctrine/doctrine2/pull/1280

Comment by Doctrine Bot [ 24/Jan/15 ]

A related Github Pull-Request [GH-1277] was labeled:
https://github.com/doctrine/doctrine2/pull/1277

Comment by Doctrine Bot [ 24/Jan/15 ]

A related Github Pull-Request [GH-1280] was assigned:
https://github.com/doctrine/doctrine2/pull/1280

Comment by Doctrine Bot [ 25/Jan/15 ]

A related Github Pull-Request [GH-1280] was merged:
https://github.com/doctrine/doctrine2/pull/1280





[DDC-3533] [GH-1279] [Doc][Reference][2nd level cache] Created: 23/Jan/15  Updated: 23/Jan/15  Resolved: 23/Jan/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Documentation, Second Level Cache
Affects Version/s: Git Master
Fix Version/s: 2.5
Security Level: All

Type: Documentation Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: documentation, rst, second-level-cache, typo


 Description   

This issue is created automatically through a Github pull request on behalf of phansys:

Url: https://github.com/doctrine/doctrine2/pull/1279

Message:

  • Fixed typo in TimestampRegion title.
  • Normalized php snippets (comments, indentation).


 Comments   
Comment by Doctrine Bot [ 23/Jan/15 ]

A related Github Pull-Request [GH-1279] was assigned:
https://github.com/doctrine/doctrine2/pull/1279

Comment by Doctrine Bot [ 23/Jan/15 ]

A related Github Pull-Request [GH-1279] was merged:
https://github.com/doctrine/doctrine2/pull/1279





[DDC-3532] [GH-1278] travis: remove unnecessary database creation Created: 22/Jan/15  Updated: 25/Jan/15  Resolved: 24/Jan/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Tools
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Improvement Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Incomplete Votes: 0
Labels: ci, performance, setup, travis

Issue Links:
Reference
is referenced by DDC-3540 [GH-1285] travis: remove unnecessary ... Open

 Description   

This issue is created automatically through a Github pull request on behalf of TomasVotruba:

Url: https://github.com/doctrine/doctrine2/pull/1278

Message:

Ref: https://github.com/doctrine/dbal/commit/a66010640cc03e73a60cee16f1da36daabd63898

https://github.com/doctrine/doctrine2/pull/1251#discussion_r23018406



 Comments   
Comment by Doctrine Bot [ 24/Jan/15 ]

A related Github Pull-Request [GH-1278] was labeled:
https://github.com/doctrine/doctrine2/pull/1278

Comment by Doctrine Bot [ 24/Jan/15 ]

A related Github Pull-Request [GH-1278] was labeled:
https://github.com/doctrine/doctrine2/pull/1278

Comment by Doctrine Bot [ 24/Jan/15 ]

A related Github Pull-Request [GH-1278] was closed:
https://github.com/doctrine/doctrine2/pull/1278

Comment by Doctrine Bot [ 24/Jan/15 ]

A related Github Pull-Request [GH-1278] was unlabeled:
https://github.com/doctrine/doctrine2/pull/1278

Comment by Doctrine Bot [ 24/Jan/15 ]

A related Github Pull-Request [GH-1278] was assigned:
https://github.com/doctrine/doctrine2/pull/1278





[DDC-3531] [GH-1277] [DDC-3346] Failing test for issue (bad findOneBy behaviour with eager fetch) Created: 22/Jan/15  Updated: 25/Jan/15  Resolved: 23/Jan/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Lazy Loading, ORM
Affects Version/s: Git Master, 2.4.7
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Duplicate Votes: 0
Labels: collection, eager, fetch, hydration, many-to-many, onetomany, persister

Issue Links:
Dependency
depends on DDC-3534 [GH-1280] [DDC-3346] #1277 find one w... Open
is required for DDC-3346 findOneBy returns an object with part... Resolved

 Description   

This issue is created automatically through a Github pull request on behalf of scaytrase:

Url: https://github.com/doctrine/doctrine2/pull/1277

Message:

Here is the test for DDC-3346(http://www.doctrine-project.org/jira/browse/DDC-3346) issue



 Comments   
Comment by Doctrine Bot [ 23/Jan/15 ]

A related Github Pull-Request [GH-1277] was assigned:
https://github.com/doctrine/doctrine2/pull/1277

Comment by Doctrine Bot [ 23/Jan/15 ]

A related Github Pull-Request [GH-1277] was closed:
https://github.com/doctrine/doctrine2/pull/1277

Comment by Doctrine Bot [ 24/Jan/15 ]

A related Github Pull-Request [GH-1280] was labeled:
https://github.com/doctrine/doctrine2/pull/1280

Comment by Doctrine Bot [ 24/Jan/15 ]

A related Github Pull-Request [GH-1277] was labeled:
https://github.com/doctrine/doctrine2/pull/1277

Comment by Doctrine Bot [ 24/Jan/15 ]

A related Github Pull-Request [GH-1280] was assigned:
https://github.com/doctrine/doctrine2/pull/1280

Comment by Doctrine Bot [ 25/Jan/15 ]

A related Github Pull-Request [GH-1280] was merged:
https://github.com/doctrine/doctrine2/pull/1280





[DDC-3530] [GH-1276] travis: run coverage just once Created: 22/Jan/15  Updated: 22/Jan/15  Resolved: 22/Jan/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Tools
Affects Version/s: 2.4.7
Fix Version/s: 2.4.8
Security Level: All

Type: Improvement Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: build-speed, ci, coverage, travis


 Description   

This issue is created automatically through a Github pull request on behalf of TomasVotruba:

Url: https://github.com/doctrine/doctrine2/pull/1276

Message:

Another speedup, just for 2.4 branch. Ref: https://github.com/doctrine/doctrine2/pull/1251

2.3 and bellow don't use coverage, so that should be all.



 Comments   
Comment by Doctrine Bot [ 22/Jan/15 ]

A related Github Pull-Request [GH-1276] was assigned:
https://github.com/doctrine/doctrine2/pull/1276

Comment by Doctrine Bot [ 22/Jan/15 ]

A related Github Pull-Request [GH-1276] was merged:
https://github.com/doctrine/doctrine2/pull/1276





[DDC-3529] [GH-1275] [WIP] Nullable embedded objects. Created: 21/Jan/15  Updated: 24/Jan/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of lcobucci:

Url: https://github.com/doctrine/doctrine2/pull/1275

Message:

The idea was to have a simple (and clean) way to override the nullable property of embedded objects, so I've
added the ```nullable``` attribute on the ```@Embedded``` annotation and it have 3 possible values:

  • NULL: The nullable option that was defined on the attributes of the embeddable class won't be overriden;
  • TRUE: All attributes of the embeddable class will be marked as nullable and the embeddable instance only would be created when data is not NULL;
  • FALSE: All attributes of the embeddable class will be marked as non-nullable.

There's a lot of things to be improved (mostly on UnitOfWork), but it's fully working with basic tests as you can see on ValueObjectsTest::testCRUDOfNullableEmbedded() case.

I would appreciate a lot your opinions!



 Comments   
Comment by Doctrine Bot [ 24/Jan/15 ]

A related Github Pull-Request [GH-1275] was labeled:
https://github.com/doctrine/doctrine2/pull/1275

Comment by Doctrine Bot [ 24/Jan/15 ]

A related Github Pull-Request [GH-1275] was labeled:
https://github.com/doctrine/doctrine2/pull/1275





[DDC-3528] [GH-1274] PersistentCollection now extends AbstractLazyCollection. Created: 21/Jan/15  Updated: 24/Jan/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: None


 Description   

This issue is created automatically through a Github pull request on behalf of guilhermeblanco:

Url: https://github.com/doctrine/doctrine2/pull/1274

Message:



 Comments   
Comment by Doctrine Bot [ 22/Jan/15 ]

A related Github Pull-Request [GH-1274] was assigned:
https://github.com/doctrine/doctrine2/pull/1274

Comment by Doctrine Bot [ 24/Jan/15 ]

A related Github Pull-Request [GH-1274] was labeled:
https://github.com/doctrine/doctrine2/pull/1274

Comment by Doctrine Bot [ 24/Jan/15 ]

A related Github Pull-Request [GH-1274] was labeled:
https://github.com/doctrine/doctrine2/pull/1274





[DDC-3527] Provide a method to retrieve exactly one entity out of entity repository Created: 20/Jan/15  Updated: 22/Jan/15

Status: Open
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: Git Master
Fix Version/s: 3.0

Type: Improvement Priority: Minor
Reporter: Dominik D Assignee: Marco Pivetta
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Hello,

currently we have EntityRepository::findOneBy() method for retrieving a single or none entities out of an EntityRepository. It would be very useful, if there was a method which retrieves exactly one entity or throws NonUniqueResultException in case of multiple records returned or NoResultException in case of zero results returned (just like Query::getSingleResult() currently does).

Very often I find myself creating custom repositories for a couple of ::findOneByOrThrow() methods only. Needless to say it's quite mundane to do. The bodies of such methods follows the same pattern:

1. Query the EntityRepository using EntityRepository::findOneBy().
2. If the result is null, then throw an Exception.
3. Return the result.

It'd be very nice to have it out-of-the-box in the base EntityRepository.

Thanks.



 Comments   
Comment by Marco Pivetta [ 20/Jan/15 ]

We actually want to reduce the repository API, not expand it...

Comment by Dominik D [ 21/Jan/15 ]

Wow, ok. I guess you've got good reasons for it and I shouldn't try to convince you, that having methods for most common use cases out of the box is quite convenient?

If yes, then fine. I can create a common EntityRepository subclass for myself and put any helper methods I want there. This would at least cut down on the code duplication in my codebase.

If what you say is final, then we can close this ticket.

Cheers.

Comment by Marco Pivetta [ 22/Jan/15 ]

I guess you've got good reasons for it and I shouldn't try to convince you, that having methods for most common use cases out of the box is quite convenient?

The main problem is that adding API methods to repositories forces any subclasses to also apply eventual filtering logic to those as well.

Other than that, it's merely a question of interface segregation: the current API is hardly maintainable if we assume that many developers subclassed the EntityRepository class, therefore we should keep it locked until 3.x.

I'll actually mark this issue for 3.0 and defer discussion till then.

Comment by Dominik D [ 22/Jan/15 ]

Ok, thanks.





[DDC-3526] [GH-1273] Incorrect @throws doc. in getSingleScalarResult Created: 20/Jan/15  Updated: 20/Jan/15  Resolved: 20/Jan/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: DQL
Affects Version/s: 2.4.7
Fix Version/s: 2.5
Security Level: All

Type: Documentation Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: docblock, query


 Description   

This issue is created automatically through a Github pull request on behalf of TrkiSF2:

Url: https://github.com/doctrine/doctrine2/pull/1273

Message:

This method doesn't throw QueryException.

The documentation should says that it throws: "NoResultException" or "NonUniqueResultException"



 Comments   
Comment by Doctrine Bot [ 20/Jan/15 ]

A related Github Pull-Request [GH-1273] was assigned:
https://github.com/doctrine/doctrine2/pull/1273

Comment by Doctrine Bot [ 20/Jan/15 ]

A related Github Pull-Request [GH-1273] was merged:
https://github.com/doctrine/doctrine2/pull/1273





[DDC-3525] Exception "The column id must be mapped to a field in class" when associationKey used Created: 20/Jan/15  Updated: 21/Jan/15

Status: Awaiting Feedback
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.4.7
Fix Version/s: None
Security Level: All

Type: Bug Priority: Major
Reporter: Ilya Antipenko Assignee: Benjamin Eberlei
Resolution: Unresolved Votes: 0
Labels: associationKey, foreign-key

Attachments: Text File foreign-key.log    

 Description   

I have issue when I use "associationKey"

I create test repo for reproduce this issue:
https://github.com/aivus/symfony2-foreign-bug

1. composer install
2. Set DB parameters in app/config/parameters.yml and create DB
3. php app/console doctrine:schema:create --force
4. php app/console server:run
5. Load fixtures: http://127.0.0.1:8000/app/loadFixture
6. Try to get list: http://127.0.0.1:8000/app_dev.php/admin/app/app/order/list

I make workaround, which works for me (https://github.com/aivus/doctrine2/commit/8461111e8aea98d02175f3642870a689d446beef), but I'm not sure about it



 Comments   
Comment by Ilya Antipenko [ 21/Jan/15 ]

Add stacktrace





[DDC-3524] [GH-1272] [DDC-2704] - merge inherited transient properties - merge properties into uninitialized proxies Created: 20/Jan/15  Updated: 25/Jan/15  Resolved: 25/Jan/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: Git Master, 2.4.7
Fix Version/s: 2.5
Security Level: All

Type: Bug Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: inheritance, merge, private-properties, transient-properties, unitofwork

Issue Links:
Dependency
is required for DDC-2704 When using Discriminator EntityManage... Resolved

 Description   

This issue is created automatically through a Github pull request on behalf of Ocramius:

Url: https://github.com/doctrine/doctrine2/pull/1272

Message:

See http://www.doctrine-project.org/jira/browse/DDC-2704 - DDC-2704



 Comments   
Comment by Doctrine Bot [ 24/Jan/15 ]

A related Github Pull-Request [GH-1272] was unlabeled:
https://github.com/doctrine/doctrine2/pull/1272

Comment by Doctrine Bot [ 25/Jan/15 ]

A related Github Pull-Request [GH-1272] was merged:
https://github.com/doctrine/doctrine2/pull/1272





[DDC-3523] [GH-1271] Update migration_2_5.rst Created: 20/Jan/15  Updated: 20/Jan/15  Resolved: 20/Jan/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Documentation
Affects Version/s: 2.5
Fix Version/s: 2.5
Security Level: All

Type: Documentation Priority: Minor
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Fixed Votes: 0
Labels: upgrade-notes


 Description   

This issue is created automatically through a Github pull request on behalf of kix:

Url: https://github.com/doctrine/doctrine2/pull/1271

Message:

Fixed some formatting issues and typos.






[DDC-3522] [GH-1270] Update composer on travis build. Created: 20/Jan/15  Updated: 20/Jan/15  Resolved: 20/Jan/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: None
Fix Version/s: None
Security Level: All

Type: Improvement Priority: Major
Reporter: Doctrine Bot Assignee: Marco Pivetta
Resolution: Duplicate Votes: 0
Labels: None

Issue Links:
Duplicate
duplicates DDC-3521 [GH-1269] [DDC-3520] self-update comp... Resolved

 Description   

This issue is created automatically through a Github pull request on behalf of guilhermeblanco:

Url: https://github.com/doctrine/doctrine2/pull/1270

Message:



 Comments   
Comment by Doctrine Bot [ 20/Jan/15 ]

A related Github Pull-Request [GH-1270] was closed:
https://github.com/doctrine/doctrine2/pull/1270





[DDC-3521] [GH-1269] [DDC-3520] self-update composer before install Created: 20/Jan/15  Updated: 20/Jan/15  Resolved: 20/Jan/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: Tools
Affects Version/s: Git Master
Fix Version/s: 2.5
Security Level: All

Type: Improvement Priority: Major
Reporter: Doctrine Bot Assignee: Guilherme Blanco
Resolution: Fixed Votes: 0
Labels: composer, travis

Issue Links:
Duplicate
is duplicated by DDC-3522 [GH-1270] Update composer on travis b... Resolved

 Description   

This issue is created automatically through a Github pull request on behalf of spdionis:

Url: https://github.com/doctrine/doctrine2/pull/1269

Message:

Updating composer before install seems like a good idea. At the moment for example the travis build is failing because of the new composer syntax with '^' and it would be fixed by composer self-update.

Sorry for the spam, opened the pull request against master this time.



 Comments   
Comment by Doctrine Bot [ 20/Jan/15 ]

A related Github Pull-Request [GH-1269] was merged:
https://github.com/doctrine/doctrine2/pull/1269





[DDC-3520] [GH-1268] Update composer before install Created: 20/Jan/15  Updated: 20/Jan/15  Resolved: 20/Jan/15

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: None
Affects Version/s: 2.4
Fix Version/s: None
Security Level: All

Type: Improvement Priority: Minor
Reporter: Doctrine Bot Assignee: Steve Müller
Resolution: Incomplete Votes: 0
Labels: composer, self-update, tests, travis


 Description   

This issue is created automatically through a Github pull request on behalf of spdionis:

Url: https://github.com/doctrine/doctrine2/pull/1268

Message:

Updating composer before install seems like a good idea. At the moment for example the travis build is failing because of the new composer syntax with '^' and it would be fixed by composer self-update.



 Comments   
Comment by Doctrine Bot [ 20/Jan/15 ]

A related Github Pull-Request [GH-1268] was closed:
https://github.com/doctrine/doctrine2/pull/1268





Generated at Mon Jan 26 20:29:08 UTC 2015 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.