I have 3 objects:
Style
Colour
Article
The article has ManyToOne's relationship with both objects (the article is a unique combination of style and color). All objects have an automatic increase in surrogate integer indices.
I have a style element and a Color object, and I want to create a new article that links these two objects if they are not already. Given that there is no way to make an equivalent ("INSERT on DUPLICATE KEY UPDATE") using the doctrine, I need to find any articles that have a BOTH relationship with my Color styles and objects. If there are no matches, create a new object.
How can I find any article object in my system that is associated with style and color objects?
class Style{ private $id; private $name; private $articles; } class Colour{ private $id; private $name; } class Article{ private $id; private $style; private $colour; }
The findBy methods described here http://www.doctrine-project.org/docs/orm/2.0/en/reference/working-with-objects.html seem to let you find objects using the string values โโof the properties of the entity, and only one of them at a time.
php orm doctrine2 findby
calumbrodie
source share