public function equals(MetaClassProperty $property) { return $property->getName() == $this->getName() && $property->getColumnName() == $this->getColumnName() && $property->getType() == $this->getType() && $property->getSize() == $this->getSize() && $property->getRelation() == $this->getRelation() && $property->isRequired() == $this->isRequired() && $property->isIdentifier() == $this->isIdentifier(); }
public function toSetter(MetaClass $class, MetaClassProperty $property, MetaClassProperty $holder = null) { $name = $property->getName(); $methodName = 'set' . ucfirst($name); if ($holder) { return <<<EOT /** * @return {$holder->getClass()->getName()} **/ public function {$methodName}(\${$name}) { \t\$this->{$holder->getName()}->{$methodName}(\${$name}); \treturn \$this; } EOT; } else { if ($property->isRequired()) { $method = <<<EOT /** * @return {$class->getName()} **/ public function {$methodName}(\${$name} = false) { \t\$this->{$name} = (\${$name} === true); \treturn \$this; } EOT; } else { $method = <<<EOT /** * @return {$class->getName()} **/ public function {$methodName}(\${$name} = null) { \tAssert::isTernaryBase(\${$name}); \t \t\$this->{$name} = \${$name}; \treturn \$this; } EOT; } } return $method; }