0

I have registered users in my application, when a user wants to unsubscribe or is locked in the database is marked as Locked

ArrayCollection all need to be changed or do I have to make a new function for each ArrayCollection?

for Example:

this is arrayCollection 

    /**
     * Get like
     *
     * @return \Doctrine\Common\Collections\Collection 
     */
    public function getLike()
    {
        return $this->like;
    }

When I user is locked i have to create a new function like:

    /**
     * Get like2
     *
     * @return \Doctrine\Common\Collections\Collection 
     */
    public function getLike2()
    {
        //USE CRITERIA OR
    $out = array();
    foreach ($this->like as $like2) {
        if (!getUser()->getLocked()) {
            $out[] = $like2;
        }
      }
    }

Or I can use the "default" ArrayCollection with some modifications

Barno
  • 3,271
  • 5
  • 28
  • 58
  • do you want to have both ? i mean the full array collection with the locked users inside AND another without the locked users or do you only want to have the "filtered" not locked users ? – nixoschu Nov 15 '13 at 12:00
  • no only one without locked user – Barno Nov 15 '13 at 13:16
  • i use the method you implemented (filtering with php) because the only way to filter it before the entity mapping that i found so far, is doing something like this http://docs.doctrine-project.org/en/latest/reference/annotations-reference.html#sqlresultsetmapping which is a combination of a custom namednativequery and a resultmapping ... quiete much of configuration :/ – nixoschu Nov 15 '13 at 14:06

0 Answers0