*/
private function set($field, $args)
{
- $this->initializeDoctrine();
-
if ($this->cm->hasField($field) && !$this->cm->isIdentifier($field)) {
$this->$field = $args[0];
} else if ($this->cm->hasAssociation($field) && $this->cm->isSingleValuedAssociation($field)) {
*/
private function get($field)
{
- $this->initializeDoctrine();
-
if ( $this->cm->hasField($field) || $this->cm->hasAssociation($field) ) {
return $this->$field;
- } else {
- throw new \BadMethodCallException("no field with name '".$field."' exists on '".$this->cm->getName()."'");
}
+
+ throw new \BadMethodCallException("no field with name '".$field."' exists on '".$this->cm->getName()."'");
}
/**
*/
private function add($field, $args)
{
- $this->initializeDoctrine();
-
if ($this->cm->hasAssociation($field) && $this->cm->isCollectionValuedAssociation($field)) {
$targetClass = $this->cm->getAssociationTargetClass($field);
if (!($args[0] instanceof $targetClass)) {
*/
public function __call($method, $args)
{
+ $this->initializeDoctrine();
+
$command = substr($method, 0, 3);
$field = lcfirst(substr($method, 3));
if ($command == "set") {