1: <?php
2:
3: 4: 5: 6: 7: 8:
9:
10: namespace rsanchez\Deep\Hydrator;
11:
12: use Illuminate\Database\Eloquent\Model;
13: use rsanchez\Deep\Model\AbstractProperty;
14: use rsanchez\Deep\Model\AbstractEntity;
15: use rsanchez\Deep\Hydrator\AbstractHydrator;
16:
17: 18: 19:
20: class ExplodeHydrator extends AbstractHydrator
21: {
22: 23: 24:
25: public function hydrate(AbstractEntity $entity, AbstractProperty $property)
26: {
27: $value = $entity->getAttribute($property->getIdentifier());
28:
29: $value = $value ? explode("\n", $value) : null;
30:
31: $entity->setAttribute($property->getName(), $value);
32:
33: return $value;
34: }
35: }
36: