If you're using the standard Zend_Application stack (and it's autoloader) I
suggest you to drop the Doctrine autoloader and keep Zend's default... Much
less confusing :)
Check this Gist, it's the (not really clean) resource I use to startup a
Doctrine2 EntityManager:
https://gist.github.com/925033
The only thing you need to do to avoid using D2's autoloader is taking care
(like I did from lines 67 to 77 in the gist) of Entity Proxies :)

Marco Pivetta
@Ocramius <http://twitter.com/Ocramius>
http://marco-pivetta.com



On 18 April 2011 10:51, tridem-zend <nabble-z...@tridem.de> wrote:

> Thanks Marco, now I understand namespaces a little bit more and my
> "toDojoArray" method works now.
> Since the getInsertDatetime returns a Doctrine DateTime object I had to
> format it. The \Zend_Date works fine now too.
>
>
>    public function toDojoArray()
>    {
>        $creationDate  = (!null == $this->getInsertDatetime()) ? new
> \Zend_Date($this->getInsertDatetime()->format('Y-m-d H:i:s') : new
> \Zend_Date();
>
>        $data = array(
>            'id'             => $this->getId(),
>            'name'           => $this->getHistoryName(),
>            'creationDate'  => array(
>                "_type"  => "Date",
>                "_value" => $creationDate->get(Zend_Date::ISO_8601)
>            ),
>            'creationDate'   => $this->getCreationDate()
>        );
>
>        return $data;
>    }
>
>
> I added the My_ (/library/My/) namespace to the Doctrine autoloader in my
> Bootstrap.php
>
>
> public function _initDoctrine() {
>        $classLoader = new \Doctrine\Common\ClassLoader('MY',
> APPLICATION_PATH . '/../library');
>        $classLoader->register();
> }
>
>
> and tried to extend the entity by using
>
> class History extends My_Entity_Base.
>
> Is this the right way?
>
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/Extending-Doctrine-entities-using-Zend-an-My-library-tp3456839p3456947.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
> --
> List: fw-general@lists.zend.com
> Info: http://framework.zend.com/archives
> Unsubscribe: fw-general-unsubscr...@lists.zend.com
>
>
>

Reply via email to