next to getter and setter functions, I often use 'hasser' functions:
/**
* @return boolean
*/
public function hasUser()
{
return $this->user instanceof \Project\Domain\Entity\User;
}
Cheers
On 18 May 2014 21:25, Nima Sadjadi <[email protected]> wrote:
>
> when I do this:
> $something = $blah->getX();
>
> $something may have no value, because may be there is not any X associated
> to $blah, I want to checv it with if statement to see if there is an entity
> for $something, update it, if no entity, create it. I tried both:
> if ($something === null) {
> and
> if ($something === false) {
> but it goes always to else clause if there is no entity found. I tried
> debug:dump and I get blank entity, this is why it is not null but when I
> want to update it, I get "entity not found" error, what should I check to
> solve this? or what wrong I did?
> I tried it with several other entities, with different associations and
> method names, and there is always such problem. plz help.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "doctrine-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/doctrine-user.
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.