I want to use the parameter place holder - e.g. ?1 - with the % wild cards. that is, something like: "u.name LIKE %?1%" (though this throws an error). The docs have the following two examples:
1.
// Example - $qb->expr()->like('u.firstname', $qb->expr()->literal('Gui%'))
public function like($x, $y); // Returns Expr\Comparison instance
...
The title says it all really. Have been using it for a while with CodeIgniter and I can't remember if I installed v2 or just copied the files from another project.
Any ideas?
...
Hi All,
I want to refactor my model so I can properly write a unit test for it. But I have some dependencies. Can anybody point me in the right direction how I can remove these dependencies?
class Customer
{
public function save(array $data, $id = NULL)
{
// create or update
if (empty($id)) {
$custom...
Is it possible to query a recursive relationship in D2 for all fields that don't have a related element specified?
...
I'm using Single Table Inheritance in Doctrine2 to store OAuth credentials for multiple services. I'd like to use the service's id as the primary key; however, that's not unique across all services.
I've setup the database to use the discriminator column and the service's id as the primary key, but I can't find a way to make Doctrine u...
I have an entity with an 'object' type column. I want to be able to retreive the entity by a property (say id) of that object. For example, the query would look something like this:
$em->createQuery('SELECT e FROM Entity_Class e SOME_MAGIC e.object o WHERE o.id = ?1');
The question is, is there *SOME_MAGIC* in dql?
...
I've recently managed to get the betas of Codeigniter 2.0 and Doctrine 2.0 working together, thanks to the help from this guide: http://eryr.wordpress.com/2010/09/26/integrating-doctrine-2-with-codeigniter-2/
I have set up the CLI as set out in that guide, but I can't run any commands - I type doctrine and get the menu and list of comma...
The following:
I have approximantely 20 models. These classes extend a base class. This base class contains a method which should be able to determine the classname of the child element. Normally you could this with:
get_called_class();
But in many cases doctrine 2 uses ProxyClasses and in that case the get_called_class() function re...
I have entity like this:
/**
*
* @Table(name="table")
* @Entity
*/
class Table {
/**
* @Column(type="integer")
* @Id
* @GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @ManyToOne(targetEntity="Entities\Users")
* @joinColumn(name="userId", referencedColumnName="id")
*/
...
I am using Doctrine 2 and am unable to delete an entity.
When I try to access a property/method of the entity, it returns the value as expected.
Doctrine\Common\Util\Debug::dump($entity->getId());
//int(17)
When I try to access the whole entity I get an error (the same error when I get when try to delete)
Doctrine\Common\Util\Debug...
I'm using Doctrine2 to manage my model below: There's an abstract concept Content with a Composite pattern in Gallery, also an abstract concept Media from which Video and Image inherits.
My choice was to add discriminators to Content and Media tables in order to differentiate between Gallery, Video and Image. Content uses JOIN inherit...
I'm trying to setup class inheritance using the Doctrine 2 ORM, but am getting errors (even when following their examples). I'm using the console from a Symfony 2 sandbox. The simple example uses the classes Person and Employee; An Employee extends Person.
The error I'm getting when trying to generate the entities is:
[Doctrine\ORM\M...
Doctrine 1.x and 2 both offer some kind of Versionable support in the form of a separate auditing table that tracks changes over time. However, the versions appear to be intended for per-row use (ie, they all maintain their own version number) instead of database-wide, such as in Hibernate Envers, which gives every row a unique revision ...
Hi all,
Is there an easy way to check for duplicate keys with Doctrine 2 before doing a flush?
...
I need to add sql logging to work in native WebProfileBundle.
When I do one default connection in application config, I see the sql
queries in my log. But my application uses many connections to many db
servers, so I can't add all the possible connections to config file.
I create runtime connections, i.e.:
$config = array(
'us...
I got this Doctrine query:
select upper(substring(e.name, 1, 1)) first_letter
from Application\Models\Exercise e
group by first_letter
order by first_letter asc
But it throws an exception with the message:
Error: 'first_letter' does not point to a Class.
If I leave out the group by and the order by,...
class Profile {
/** @OneToMany(targetEntity="Link", mappedBy="owner") */
private $links;
}
class Link {
/**
* @ManyToOne(targetEntity="Profile", inversedBy="links")
* @JoinColumn(name="owner_id", referencedColumnName="id")
*/
public $owner;
/**
* @ManyToOne(targetEntity="Profile")
* @JoinC...
Is it possible to generate Doctrine 2 entities, with the relevant docblock annotations, from an existing database schema?
...