I am switching from Zend_Db (including mappers and DbTable) to Doctrine 2.0.
My former directory strucure was:
/application/
/application/models/
/application/models/DbTable
/application/models/mappers
So far so good I created my models from database including all relations. I
still have a copy of my old models and simply added the Doctrine entities
here:
/application/
/application/Entities/
/application/Entities/Proxies
/application/Entities/Repositiories
/application/models/
/application/models/DbTable
/application/models/mappers
My old models extended an abstract class with methods like "toArray" or
"toDojoArray" etc. and I would like to continue using them. That's why I
tried to extend my Entity f.e.:
<?php
namespace Entities;
#use \Zend\Date as Zend_Date;
use \My\Entity\Base as My_Entity_Base;
/**
* History
*
* @Table(name="history")
* @Entity(repositoryClass="\Entities\Repositories\HistoryRepository")
*/
class History extends My_Entity_Base
First of all is this a good idea? Unfortunately though my autoloading seems
to work fine I still have problems with using namespaces. Could someone show
me the correct path to extend?
My second problem is using Zend_* inside the entites f.e.:
public function toDojoArray()
{
$creationDate = (!null == $this->getInsertDatetime()) ? new
\Zend\Date($this->getInsertDatetime()) : 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;
}
The Doctrine entity simply doesn't load the Zend library.
Please help! Thanks!
--
View this message in context:
http://zend-framework-community.634137.n4.nabble.com/Extending-Doctrine-entities-using-Zend-an-My-library-tp3456839p3456839.html
Sent from the Zend Framework mailing list archive at Nabble.com.
--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]