stephpy/timeline-bundle

Exception when i try to display timeline

Closed this issue · 1 comments

Hello,
Hello,

$elements is an array of identifiers.

I want to add this action to my timeline:

$elementsComps = $this->findOrCreateComponent ('MyClass', $elements );
$action = $this->create ( $subject, 'publish_added_photo_album', array ('elements'=>$elementsComps) );
$this->updateAction ( $action );

when i try to display the timeline, i got the exception below, does method findOrCreateComponent accepts array of Ids?
Thank you

ContextErrorException: Notice: Array to string conversion in C:\wamp\www\Symfony\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Expr.php line 568
in C:\wamp\www\Symfony\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Expr.php line 568
at ErrorHandler->handle('8', 'Array to string conversion', 'C:\wamp\www\Symfony\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Expr.php', '568', array('literal' => array('2'))) in C:\wamp\www\Symfony\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Expr.php line 568
at Expr->_quoteLiteral(array('2')) in C:\wamp\www\Symfony\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Expr.php line 422
at Expr->in('r.id', array(array('2'))) in C:\wamp\www\Symfony\vendor\stephpy\TimelineBundle\Spy\TimelineBundle\Filter\DataHydrator\Locator\DoctrineORM.php line 75

Hi,

findOrCreateCompontent accepts an array of id. But it's to define ONE element (array is supported for many primary keys).

If $elementComps define +1 elements, you should call x times findOrCreateComponent.
Then, on ->create, you cannot provide an ARRAY of entities, you can give an entity for one ky element0 => $element0, element1=>$element1.