| @@ 860-881 (lines=22) @@ | ||
| 857 | * |
|
| 858 | * @return bool |
|
| 859 | */ |
|
| 860 | protected function hasProperty($property, ClassMetadataInfo $metadata) |
|
| 861 | { |
|
| 862 | if ($this->extendsClass() || (!$this->isNew && class_exists($metadata->name))) { |
|
| 863 | // don't generate property if its already on the base class. |
|
| 864 | $reflClass = new \ReflectionClass($this->getClassToExtend() ?: $metadata->name); |
|
| 865 | if ($reflClass->hasProperty($property)) { |
|
| 866 | return true; |
|
| 867 | } |
|
| 868 | } |
|
| 869 | ||
| 870 | // check traits for existing property |
|
| 871 | foreach ($this->getTraits($metadata) as $trait) { |
|
| 872 | if ($trait->hasProperty($property)) { |
|
| 873 | return true; |
|
| 874 | } |
|
| 875 | } |
|
| 876 | ||
| 877 | return ( |
|
| 878 | isset($this->staticReflection[$metadata->name]) && |
|
| 879 | in_array($property, $this->staticReflection[$metadata->name]['properties'], true) |
|
| 880 | ); |
|
| 881 | } |
|
| 882 | ||
| 883 | /** |
|
| 884 | * @param string $method |
|
| @@ 889-911 (lines=23) @@ | ||
| 886 | * |
|
| 887 | * @return bool |
|
| 888 | */ |
|
| 889 | protected function hasMethod($method, ClassMetadataInfo $metadata) |
|
| 890 | { |
|
| 891 | if ($this->extendsClass() || (!$this->isNew && class_exists($metadata->name))) { |
|
| 892 | // don't generate method if its already on the base class. |
|
| 893 | $reflClass = new \ReflectionClass($this->getClassToExtend() ?: $metadata->name); |
|
| 894 | ||
| 895 | if ($reflClass->hasMethod($method)) { |
|
| 896 | return true; |
|
| 897 | } |
|
| 898 | } |
|
| 899 | ||
| 900 | // check traits for existing method |
|
| 901 | foreach ($this->getTraits($metadata) as $trait) { |
|
| 902 | if ($trait->hasMethod($method)) { |
|
| 903 | return true; |
|
| 904 | } |
|
| 905 | } |
|
| 906 | ||
| 907 | return ( |
|
| 908 | isset($this->staticReflection[$metadata->name]) && |
|
| 909 | in_array(strtolower($method), $this->staticReflection[$metadata->name]['methods'], true) |
|
| 910 | ); |
|
| 911 | } |
|
| 912 | ||
| 913 | /** |
|
| 914 | * @param ClassMetadataInfo $metadata |
|