/** * Constructor */ public function __construct(Tag $tag = null, Taggable $resource = null) { parent::__construct(); if ($tag != null) { $this->setTag($tag); } if ($resource != null) { $this->setResource($resource); } $this->setCreated(new \DateTime('now')); }
/** * @param Tag|null $tag * @param object|null $entity */ public function __construct(Tag $tag = null, $entity = null) { parent::__construct(); if ($tag != null) { $this->setTag($tag); } if ($entity != null) { if ($entity instanceof Taggable) { $this->setResource($entity); } else { $this->setEntity($entity); } } $this->setCreated(new \DateTime('now')); }