public function cleanCustomFields(int $id): bool
    {
        $reflector = new \ReflectionClass($this);
        $classNameWithNameSpace = $reflector->getNamespaceName() . '\\' . $reflector->getShortName() . 'CustomFields';
        $customModel = new $classNameWithNameSpace();

        //return $customModel->find(['conditions' => $this->getSource() . '_id = ?0', 'bind' => [$id]])->delete();
        //we need to run the query since we dont have primary key
        $result = $this->getReadConnection()->prepare("DELETE FROM {$customModel->getSource()} WHERE " . $this->getSource() . '_id = ?');
        return $result->execute([$id]);
    }
public function cleanCustomFields(int $id): bool
    {
        $reflector = new \ReflectionClass($this);
        $classNameWithNameSpace = $reflector->getNamespaceName() . '\\' . $reflector->getShortName() . 'CustomFields';
        $customModel = new $classNameWithNameSpace();

        //return $customModel->find(['conditions' => $this->getSource() . '_id = ?0', 'bind' => [$id]])->delete();
        //we need to run the query since we dont have primary key
        $result = $this->getReadConnection()->prepare("DELETE FROM {$customModel->getSource()} WHERE " . $this->getSource() . '_id = ?');
        return $result->execute([$id]);
    }
public function cleanCustomFields ( int $ id ) : bool { $ reflector = new \ ReflectionClass ( $ this ) ; $ classNameWithNameSpace = $ reflector -> getNamespaceName ( ) . '\\' . $ reflector -> getShortName ( ) . 'CustomFields' ; $ customModel = new $ classNameWithNameSpace ( ) ; //return $customModel->find(['conditions' => $this->getSource() . '_id = ?0', 'bind' => [$id]])->delete(); //we need to run the query since we dont have primary key $ result = $ this -> getReadConnection ( ) -> prepare ( "DELETE FROM {$customModel->getSource()} WHERE " . $ this -> getSource ( ) . '_id = ?' ) ; return $ result -> execute ( [ $ id ] ) ; }
Remove all the custom fields from the entity

@param  int $id
@return \Phalcon\MVC\Models
Remove all the custom fields from the entity