/** * Transforms an ArrayCollection Object to a single Object. * * @param \Doctrine\ORM\PersistentCollection $value * * @return Object */ public function transform($value) { if (null === $value || !$value instanceof Collection) { return ''; } $string = ''; foreach ($value as $item) { $string .= $item->getId(); if ($value->last() != $item) { $string .= ','; } } return $string; }
/** * Do not use this method when performance is important since it used the entire collection * * @return Revision */ public function getLatestRevision() { if (empty($this->revisions)) { return null; } return $this->revisions->last(); }