예제 #1
0
 /**
  * @param CallbackBag $callbackBag
  */
 protected function updateSimpleProperty(CallbackBag $callbackBag)
 {
     $prefixes = $this->getPrefixByProp($callbackBag->getProp());
     $removePrefix = $prefixes[0];
     $addPrefix = $prefixes[1];
     $value = $callbackBag->getArgument(0);
     if (null !== $prefixes && !$callbackBag->getArgument(1, false)) {
         $mappedBy = $callbackBag->getMappedBy();
         $removeMethod = $removePrefix . ucfirst($mappedBy);
         $addMethod = $addPrefix . ucfirst($mappedBy);
         if (!is_null($callbackBag->getProperty())) {
             $callbackBag->getProperty()->{$removeMethod}(Set::PREFIX !== $removePrefix ? $callbackBag->getObject() : null, true);
         }
         if (!is_null($value)) {
             $value->{$addMethod}($callbackBag->getObject(), true);
         }
     }
     $callbackBag->setProperty($value);
 }
 /**
  * @param CallbackBag $callbackBag
  */
 protected function propertyDefault(CallbackBag $callbackBag)
 {
     if (null === $callbackBag->getProperty()) {
         $callbackBag->setProperty(array());
     }
 }